{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-10-30T21:44:42.172127Z",
     "start_time": "2018-10-30T21:44:42.159418Z"
    }
   },
   "outputs": [],
   "source": [
    "import re\n",
    "import warnings\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "from alphalens.utils import get_clean_factor_and_forward_returns\n",
    "from alphalens.performance import *\n",
    "from alphalens.plotting import *\n",
    "from alphalens.tears import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-10-30T21:44:42.408107Z",
     "start_time": "2018-10-30T21:44:42.399809Z"
    }
   },
   "outputs": [],
   "source": [
    "warnings.filterwarnings('ignore')\n",
    "%matplotlib inline\n",
    "plt.style.use('fivethirtyeight')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Version conflict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "At the time of writing, `zipline` required `pandas<=0.22` so you may need to run `pip install -U zipline` to temporarily downgrade `pandas` or set up a separate environment."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-10-30T21:44:45.065562Z",
     "start_time": "2018-10-30T21:44:43.689717Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "!pip install -U zipline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Zipline AlphaFactor Test"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We are first going to illustrate the zipline alpha factor research workflow in an offline environment. In particular, we will develop and test a simple mean-reversion factor that measures how much recent performance has deviated from the historical average. \n",
    "\n",
    "Short-term reversal is a common strategy that takes advantage of the weakly predictive pattern that stock price increases are likely to mean-revert back down over horizons from less than a minute to one month."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To this end, the factor computes the z-score for the last monthly return relative to the rolling monthly returns over the last year. At this point, we will not place any orders to simply illustrate the implementation of a CustomFactor and record the results during the simulation.\n",
    "\n",
    "After some basic settings, `MeanReversion` subclasses `CustomFactor` and defines a `compute()` method. It creates default inputs of monthly returns over an also default year-long window so that the monthly_return variable will have 252 rows and one column for each security in the Quandl dataset on a given day.\n",
    "\n",
    "The `compute_factors()` method creates a `MeanReversion` factor instance and creates long, short, and ranking pipeline columns. The former two contain Boolean values that could be used to place orders, and the latter reflects that overall ranking to evaluate the overall factor performance. Furthermore, it uses the built-in `AverageDollarVolume` factor to limit the computation to more liquid stocks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The result would allow us to place long and short orders. We will see in the next chapter how to build a portfolio by choosing a rebalancing period and adjusting portfolio holdings as new signals arrive."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- The `initialize()` method registers the compute_factors() pipeline, and the before_trading_start() method ensures the pipeline runs on a daily basis. \n",
    "- The `record()` function adds the pipeline's ranking column as well as the current asset prices to the performance DataFrame returned by the `run_algorithm()` function"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We will use the factor and pricing data stored in the performance DataFrame to evaluate the factor performance for various holding periods in the next section, but first, we'll take a look at how to create more complex signals by combining several alpha factors from a diverse set of data sources on the Quantopian platform."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Run using jupyter notebook extension"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-10-30T21:44:57.213473Z",
     "start_time": "2018-10-30T21:44:57.201320Z"
    }
   },
   "outputs": [],
   "source": [
    "%load_ext zipline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-10-30T21:45:15.973681Z",
     "start_time": "2018-10-30T21:44:57.402572Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>algo_volatility</th>\n",
       "      <th>algorithm_period_return</th>\n",
       "      <th>alpha</th>\n",
       "      <th>benchmark_period_return</th>\n",
       "      <th>benchmark_volatility</th>\n",
       "      <th>beta</th>\n",
       "      <th>capital_used</th>\n",
       "      <th>ending_cash</th>\n",
       "      <th>ending_exposure</th>\n",
       "      <th>ending_value</th>\n",
       "      <th>...</th>\n",
       "      <th>short_exposure</th>\n",
       "      <th>short_value</th>\n",
       "      <th>shorts_count</th>\n",
       "      <th>sortino</th>\n",
       "      <th>starting_cash</th>\n",
       "      <th>starting_exposure</th>\n",
       "      <th>starting_value</th>\n",
       "      <th>trading_days</th>\n",
       "      <th>transactions</th>\n",
       "      <th>treasury_period_return</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2015-01-02 21:00:00+00:00</th>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-0.000535</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.000000e+07</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.000000e+07</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1</td>\n",
       "      <td>[]</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-05 21:00:00+00:00</th>\n",
       "      <td>0.001658</td>\n",
       "      <td>-0.000148</td>\n",
       "      <td>0.001137</td>\n",
       "      <td>-0.018585</td>\n",
       "      <td>0.196709</td>\n",
       "      <td>0.008430</td>\n",
       "      <td>4.557735e+06</td>\n",
       "      <td>1.455774e+07</td>\n",
       "      <td>-4.559213e+06</td>\n",
       "      <td>-4.559213e+06</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.559213e+06</td>\n",
       "      <td>-4.559213e+06</td>\n",
       "      <td>4</td>\n",
       "      <td>-11.224972</td>\n",
       "      <td>1.000000e+07</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>2</td>\n",
       "      <td>[{u'commission': None, u'amount': -25524, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-06 21:00:00+00:00</th>\n",
       "      <td>0.041095</td>\n",
       "      <td>-0.004703</td>\n",
       "      <td>-0.369692</td>\n",
       "      <td>-0.027829</td>\n",
       "      <td>0.139099</td>\n",
       "      <td>0.010798</td>\n",
       "      <td>1.392954e+07</td>\n",
       "      <td>2.848728e+07</td>\n",
       "      <td>-1.853431e+07</td>\n",
       "      <td>-1.853431e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.853431e+07</td>\n",
       "      <td>-1.853431e+07</td>\n",
       "      <td>5</td>\n",
       "      <td>-9.457366</td>\n",
       "      <td>1.455774e+07</td>\n",
       "      <td>-4.559213e+06</td>\n",
       "      <td>-4.559213e+06</td>\n",
       "      <td>3</td>\n",
       "      <td>[{u'commission': None, u'amount': -30574, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-07 21:00:00+00:00</th>\n",
       "      <td>0.092916</td>\n",
       "      <td>-0.017128</td>\n",
       "      <td>-1.422556</td>\n",
       "      <td>-0.015715</td>\n",
       "      <td>0.206972</td>\n",
       "      <td>-0.346724</td>\n",
       "      <td>5.821402e+06</td>\n",
       "      <td>3.430868e+07</td>\n",
       "      <td>-2.447996e+07</td>\n",
       "      <td>-2.447996e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.447996e+07</td>\n",
       "      <td>-2.447996e+07</td>\n",
       "      <td>5</td>\n",
       "      <td>-10.264901</td>\n",
       "      <td>2.848728e+07</td>\n",
       "      <td>-1.853431e+07</td>\n",
       "      <td>-1.853431e+07</td>\n",
       "      <td>4</td>\n",
       "      <td>[{u'commission': None, u'amount': -22032, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-08 21:00:00+00:00</th>\n",
       "      <td>0.219120</td>\n",
       "      <td>-0.049569</td>\n",
       "      <td>-2.445576</td>\n",
       "      <td>0.001751</td>\n",
       "      <td>0.236040</td>\n",
       "      <td>-0.761751</td>\n",
       "      <td>4.882509e+06</td>\n",
       "      <td>3.919119e+07</td>\n",
       "      <td>-2.968687e+07</td>\n",
       "      <td>-2.968687e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.968687e+07</td>\n",
       "      <td>-2.968687e+07</td>\n",
       "      <td>5</td>\n",
       "      <td>-10.014855</td>\n",
       "      <td>3.430868e+07</td>\n",
       "      <td>-2.447996e+07</td>\n",
       "      <td>-2.447996e+07</td>\n",
       "      <td>5</td>\n",
       "      <td>[{u'commission': None, u'amount': -50424, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-09 21:00:00+00:00</th>\n",
       "      <td>0.432739</td>\n",
       "      <td>-0.115691</td>\n",
       "      <td>-5.095987</td>\n",
       "      <td>-0.006276</td>\n",
       "      <td>0.218110</td>\n",
       "      <td>-0.269478</td>\n",
       "      <td>4.057730e+06</td>\n",
       "      <td>4.324892e+07</td>\n",
       "      <td>-3.440583e+07</td>\n",
       "      <td>-3.440583e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-3.440583e+07</td>\n",
       "      <td>-3.440583e+07</td>\n",
       "      <td>5</td>\n",
       "      <td>-9.932744</td>\n",
       "      <td>3.919119e+07</td>\n",
       "      <td>-2.968687e+07</td>\n",
       "      <td>-2.968687e+07</td>\n",
       "      <td>6</td>\n",
       "      <td>[{u'commission': None, u'amount': -29366, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-12 21:00:00+00:00</th>\n",
       "      <td>0.650275</td>\n",
       "      <td>-0.057214</td>\n",
       "      <td>-2.310900</td>\n",
       "      <td>-0.014061</td>\n",
       "      <td>0.203321</td>\n",
       "      <td>-0.772985</td>\n",
       "      <td>1.669051e+06</td>\n",
       "      <td>4.491797e+07</td>\n",
       "      <td>-3.549011e+07</td>\n",
       "      <td>-3.549011e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-3.549011e+07</td>\n",
       "      <td>-3.549011e+07</td>\n",
       "      <td>5</td>\n",
       "      <td>-4.118403</td>\n",
       "      <td>4.324892e+07</td>\n",
       "      <td>-3.440583e+07</td>\n",
       "      <td>-3.440583e+07</td>\n",
       "      <td>7</td>\n",
       "      <td>[{u'commission': None, u'amount': -19344, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-13 21:00:00+00:00</th>\n",
       "      <td>0.620539</td>\n",
       "      <td>-0.039174</td>\n",
       "      <td>-1.498151</td>\n",
       "      <td>-0.016834</td>\n",
       "      <td>0.188301</td>\n",
       "      <td>-0.792991</td>\n",
       "      <td>4.810981e+06</td>\n",
       "      <td>4.972895e+07</td>\n",
       "      <td>-4.012069e+07</td>\n",
       "      <td>-4.012069e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.012069e+07</td>\n",
       "      <td>-4.012069e+07</td>\n",
       "      <td>8</td>\n",
       "      <td>-2.478067</td>\n",
       "      <td>4.491797e+07</td>\n",
       "      <td>-3.549011e+07</td>\n",
       "      <td>-3.549011e+07</td>\n",
       "      <td>8</td>\n",
       "      <td>[{u'commission': None, u'amount': -17806, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-14 21:00:00+00:00</th>\n",
       "      <td>0.684345</td>\n",
       "      <td>-0.109137</td>\n",
       "      <td>-3.344705</td>\n",
       "      <td>-0.022770</td>\n",
       "      <td>0.177393</td>\n",
       "      <td>-0.539288</td>\n",
       "      <td>8.473548e+05</td>\n",
       "      <td>5.057631e+07</td>\n",
       "      <td>-4.166767e+07</td>\n",
       "      <td>-4.166767e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.166767e+07</td>\n",
       "      <td>-4.166767e+07</td>\n",
       "      <td>8</td>\n",
       "      <td>-5.316664</td>\n",
       "      <td>4.972895e+07</td>\n",
       "      <td>-4.012069e+07</td>\n",
       "      <td>-4.012069e+07</td>\n",
       "      <td>9</td>\n",
       "      <td>[{u'commission': None, u'amount': -47673, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-15 21:00:00+00:00</th>\n",
       "      <td>0.891547</td>\n",
       "      <td>-0.010570</td>\n",
       "      <td>-0.894328</td>\n",
       "      <td>-0.031722</td>\n",
       "      <td>0.170557</td>\n",
       "      <td>-1.225731</td>\n",
       "      <td>-9.093704e+05</td>\n",
       "      <td>4.966693e+07</td>\n",
       "      <td>-3.977263e+07</td>\n",
       "      <td>-3.977263e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-3.977263e+07</td>\n",
       "      <td>-3.977263e+07</td>\n",
       "      <td>7</td>\n",
       "      <td>0.156254</td>\n",
       "      <td>5.057631e+07</td>\n",
       "      <td>-4.166767e+07</td>\n",
       "      <td>-4.166767e+07</td>\n",
       "      <td>10</td>\n",
       "      <td>[{u'commission': None, u'amount': -9372, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-16 21:00:00+00:00</th>\n",
       "      <td>0.997364</td>\n",
       "      <td>-0.119502</td>\n",
       "      <td>-3.411624</td>\n",
       "      <td>-0.019024</td>\n",
       "      <td>0.179592</td>\n",
       "      <td>-2.271973</td>\n",
       "      <td>1.540644e+06</td>\n",
       "      <td>5.120758e+07</td>\n",
       "      <td>-4.240260e+07</td>\n",
       "      <td>-4.240260e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.240260e+07</td>\n",
       "      <td>-4.240260e+07</td>\n",
       "      <td>7</td>\n",
       "      <td>-3.331612</td>\n",
       "      <td>4.966693e+07</td>\n",
       "      <td>-3.977263e+07</td>\n",
       "      <td>-3.977263e+07</td>\n",
       "      <td>11</td>\n",
       "      <td>[{u'commission': None, u'amount': -17798, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-20 21:00:00+00:00</th>\n",
       "      <td>0.951020</td>\n",
       "      <td>-0.130281</td>\n",
       "      <td>-3.278148</td>\n",
       "      <td>-0.016956</td>\n",
       "      <td>0.172115</td>\n",
       "      <td>-2.255599</td>\n",
       "      <td>3.370567e+06</td>\n",
       "      <td>5.457815e+07</td>\n",
       "      <td>-4.588095e+07</td>\n",
       "      <td>-4.588095e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.588095e+07</td>\n",
       "      <td>-4.588095e+07</td>\n",
       "      <td>6</td>\n",
       "      <td>-3.544205</td>\n",
       "      <td>5.120758e+07</td>\n",
       "      <td>-4.240260e+07</td>\n",
       "      <td>-4.240260e+07</td>\n",
       "      <td>12</td>\n",
       "      <td>[{u'commission': None, u'amount': -115267, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-21 21:00:00+00:00</th>\n",
       "      <td>1.101656</td>\n",
       "      <td>-0.261408</td>\n",
       "      <td>-5.851162</td>\n",
       "      <td>-0.011969</td>\n",
       "      <td>0.167211</td>\n",
       "      <td>-2.819883</td>\n",
       "      <td>1.377785e+07</td>\n",
       "      <td>6.835600e+07</td>\n",
       "      <td>-6.097007e+07</td>\n",
       "      <td>-6.097007e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.097007e+07</td>\n",
       "      <td>-6.097007e+07</td>\n",
       "      <td>15</td>\n",
       "      <td>-5.513570</td>\n",
       "      <td>5.457815e+07</td>\n",
       "      <td>-4.588095e+07</td>\n",
       "      <td>-4.588095e+07</td>\n",
       "      <td>13</td>\n",
       "      <td>[{u'commission': None, u'amount': -99824, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-22 21:00:00+00:00</th>\n",
       "      <td>1.071080</td>\n",
       "      <td>-0.248171</td>\n",
       "      <td>-4.404805</td>\n",
       "      <td>0.002724</td>\n",
       "      <td>0.173987</td>\n",
       "      <td>-2.042067</td>\n",
       "      <td>7.649323e+06</td>\n",
       "      <td>7.600532e+07</td>\n",
       "      <td>-6.848702e+07</td>\n",
       "      <td>-6.848702e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.848702e+07</td>\n",
       "      <td>-6.848702e+07</td>\n",
       "      <td>15</td>\n",
       "      <td>-4.960051</td>\n",
       "      <td>6.835600e+07</td>\n",
       "      <td>-6.097007e+07</td>\n",
       "      <td>-6.097007e+07</td>\n",
       "      <td>14</td>\n",
       "      <td>[{u'commission': None, u'amount': -74300, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-23 21:00:00+00:00</th>\n",
       "      <td>1.110031</td>\n",
       "      <td>-0.186760</td>\n",
       "      <td>-2.936846</td>\n",
       "      <td>-0.002773</td>\n",
       "      <td>0.169297</td>\n",
       "      <td>-2.337669</td>\n",
       "      <td>7.143408e+06</td>\n",
       "      <td>8.314873e+07</td>\n",
       "      <td>-7.501632e+07</td>\n",
       "      <td>-7.501632e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.501632e+07</td>\n",
       "      <td>-7.501632e+07</td>\n",
       "      <td>14</td>\n",
       "      <td>-3.237792</td>\n",
       "      <td>7.600532e+07</td>\n",
       "      <td>-6.848702e+07</td>\n",
       "      <td>-6.848702e+07</td>\n",
       "      <td>15</td>\n",
       "      <td>[{u'commission': None, u'amount': -108498, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-26 21:00:00+00:00</th>\n",
       "      <td>1.235179</td>\n",
       "      <td>-0.321580</td>\n",
       "      <td>-5.276909</td>\n",
       "      <td>-0.000438</td>\n",
       "      <td>0.163851</td>\n",
       "      <td>-2.553404</td>\n",
       "      <td>6.568951e+06</td>\n",
       "      <td>8.971768e+07</td>\n",
       "      <td>-8.293347e+07</td>\n",
       "      <td>-8.293347e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.293347e+07</td>\n",
       "      <td>-8.293347e+07</td>\n",
       "      <td>14</td>\n",
       "      <td>-4.904806</td>\n",
       "      <td>8.314873e+07</td>\n",
       "      <td>-7.501632e+07</td>\n",
       "      <td>-7.501632e+07</td>\n",
       "      <td>16</td>\n",
       "      <td>[{u'commission': None, u'amount': -127595, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-27 21:00:00+00:00</th>\n",
       "      <td>1.196141</td>\n",
       "      <td>-0.339522</td>\n",
       "      <td>-5.805218</td>\n",
       "      <td>-0.013623</td>\n",
       "      <td>0.166604</td>\n",
       "      <td>-2.276883</td>\n",
       "      <td>3.765221e+06</td>\n",
       "      <td>9.348290e+07</td>\n",
       "      <td>-8.687812e+07</td>\n",
       "      <td>-8.687812e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.687812e+07</td>\n",
       "      <td>-8.687812e+07</td>\n",
       "      <td>16</td>\n",
       "      <td>-5.108828</td>\n",
       "      <td>8.971768e+07</td>\n",
       "      <td>-8.293347e+07</td>\n",
       "      <td>-8.293347e+07</td>\n",
       "      <td>17</td>\n",
       "      <td>[{u'commission': None, u'amount': -124112, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-28 21:00:00+00:00</th>\n",
       "      <td>1.304600</td>\n",
       "      <td>-0.248371</td>\n",
       "      <td>-4.243485</td>\n",
       "      <td>-0.026272</td>\n",
       "      <td>0.167820</td>\n",
       "      <td>-3.067903</td>\n",
       "      <td>-6.870838e+06</td>\n",
       "      <td>8.661206e+07</td>\n",
       "      <td>-7.909577e+07</td>\n",
       "      <td>-7.909577e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.909577e+07</td>\n",
       "      <td>-7.909577e+07</td>\n",
       "      <td>15</td>\n",
       "      <td>-3.074204</td>\n",
       "      <td>9.348290e+07</td>\n",
       "      <td>-8.687812e+07</td>\n",
       "      <td>-8.687812e+07</td>\n",
       "      <td>18</td>\n",
       "      <td>[{u'commission': None, u'amount': -76343, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-29 21:00:00+00:00</th>\n",
       "      <td>1.268207</td>\n",
       "      <td>-0.251469</td>\n",
       "      <td>-3.653629</td>\n",
       "      <td>-0.017271</td>\n",
       "      <td>0.167657</td>\n",
       "      <td>-2.861086</td>\n",
       "      <td>-2.009625e+06</td>\n",
       "      <td>8.460244e+07</td>\n",
       "      <td>-7.711712e+07</td>\n",
       "      <td>-7.711712e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.711712e+07</td>\n",
       "      <td>-7.711712e+07</td>\n",
       "      <td>15</td>\n",
       "      <td>-3.046823</td>\n",
       "      <td>8.661206e+07</td>\n",
       "      <td>-7.909577e+07</td>\n",
       "      <td>-7.909577e+07</td>\n",
       "      <td>19</td>\n",
       "      <td>[{u'commission': None, u'amount': -136315, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-01-30 21:00:00+00:00</th>\n",
       "      <td>1.263830</td>\n",
       "      <td>-0.203276</td>\n",
       "      <td>-3.194634</td>\n",
       "      <td>-0.029630</td>\n",
       "      <td>0.168398</td>\n",
       "      <td>-3.084339</td>\n",
       "      <td>2.145741e+06</td>\n",
       "      <td>8.674818e+07</td>\n",
       "      <td>-7.878094e+07</td>\n",
       "      <td>-7.878094e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.878094e+07</td>\n",
       "      <td>-7.878094e+07</td>\n",
       "      <td>13</td>\n",
       "      <td>-2.133005</td>\n",
       "      <td>8.460244e+07</td>\n",
       "      <td>-7.711712e+07</td>\n",
       "      <td>-7.711712e+07</td>\n",
       "      <td>20</td>\n",
       "      <td>[{u'commission': None, u'amount': -103178, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-02 21:00:00+00:00</th>\n",
       "      <td>1.235822</td>\n",
       "      <td>-0.186983</td>\n",
       "      <td>-2.258068</td>\n",
       "      <td>-0.017613</td>\n",
       "      <td>0.170987</td>\n",
       "      <td>-2.679374</td>\n",
       "      <td>2.432214e+06</td>\n",
       "      <td>8.918039e+07</td>\n",
       "      <td>-8.105022e+07</td>\n",
       "      <td>-8.105022e+07</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.105022e+07</td>\n",
       "      <td>-8.105022e+07</td>\n",
       "      <td>12</td>\n",
       "      <td>-1.822251</td>\n",
       "      <td>8.674818e+07</td>\n",
       "      <td>-7.878094e+07</td>\n",
       "      <td>-7.878094e+07</td>\n",
       "      <td>21</td>\n",
       "      <td>[{u'commission': None, u'amount': -12267, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-03 21:00:00+00:00</th>\n",
       "      <td>1.308755</td>\n",
       "      <td>-0.314636</td>\n",
       "      <td>-3.525439</td>\n",
       "      <td>-0.003406</td>\n",
       "      <td>0.174668</td>\n",
       "      <td>-3.305288</td>\n",
       "      <td>1.861897e+07</td>\n",
       "      <td>1.077994e+08</td>\n",
       "      <td>-1.009457e+08</td>\n",
       "      <td>-1.009457e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.009457e+08</td>\n",
       "      <td>-1.009457e+08</td>\n",
       "      <td>17</td>\n",
       "      <td>-3.230177</td>\n",
       "      <td>8.918039e+07</td>\n",
       "      <td>-8.105022e+07</td>\n",
       "      <td>-8.105022e+07</td>\n",
       "      <td>22</td>\n",
       "      <td>[{u'commission': None, u'amount': 69168, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-04 21:00:00+00:00</th>\n",
       "      <td>1.361430</td>\n",
       "      <td>-0.227216</td>\n",
       "      <td>-2.124213</td>\n",
       "      <td>-0.007201</td>\n",
       "      <td>0.171094</td>\n",
       "      <td>-3.484392</td>\n",
       "      <td>5.884296e+06</td>\n",
       "      <td>1.136837e+08</td>\n",
       "      <td>-1.059558e+08</td>\n",
       "      <td>-1.059558e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.059558e+08</td>\n",
       "      <td>-1.059558e+08</td>\n",
       "      <td>16</td>\n",
       "      <td>-1.819097</td>\n",
       "      <td>1.077994e+08</td>\n",
       "      <td>-1.009457e+08</td>\n",
       "      <td>-1.009457e+08</td>\n",
       "      <td>23</td>\n",
       "      <td>[{u'commission': None, u'amount': -11069, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-05 21:00:00+00:00</th>\n",
       "      <td>1.428325</td>\n",
       "      <td>-0.356313</td>\n",
       "      <td>-3.400375</td>\n",
       "      <td>0.002821</td>\n",
       "      <td>0.170663</td>\n",
       "      <td>-3.945173</td>\n",
       "      <td>1.839498e+06</td>\n",
       "      <td>1.155232e+08</td>\n",
       "      <td>-1.090863e+08</td>\n",
       "      <td>-1.090863e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.090863e+08</td>\n",
       "      <td>-1.090863e+08</td>\n",
       "      <td>16</td>\n",
       "      <td>-3.091268</td>\n",
       "      <td>1.136837e+08</td>\n",
       "      <td>-1.059558e+08</td>\n",
       "      <td>-1.059558e+08</td>\n",
       "      <td>24</td>\n",
       "      <td>[{u'commission': None, u'amount': 61140, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-06 21:00:00+00:00</th>\n",
       "      <td>1.605345</td>\n",
       "      <td>-0.205537</td>\n",
       "      <td>-1.009723</td>\n",
       "      <td>0.000048</td>\n",
       "      <td>0.167330</td>\n",
       "      <td>-4.195653</td>\n",
       "      <td>1.019052e+06</td>\n",
       "      <td>1.165422e+08</td>\n",
       "      <td>-1.085976e+08</td>\n",
       "      <td>-1.085976e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.085976e+08</td>\n",
       "      <td>-1.085976e+08</td>\n",
       "      <td>16</td>\n",
       "      <td>-0.943388</td>\n",
       "      <td>1.155232e+08</td>\n",
       "      <td>-1.090863e+08</td>\n",
       "      <td>-1.090863e+08</td>\n",
       "      <td>25</td>\n",
       "      <td>[{u'commission': None, u'amount': 75944, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-09 21:00:00+00:00</th>\n",
       "      <td>1.609758</td>\n",
       "      <td>-0.121516</td>\n",
       "      <td>-0.132270</td>\n",
       "      <td>-0.004427</td>\n",
       "      <td>0.164555</td>\n",
       "      <td>-4.343213</td>\n",
       "      <td>1.153572e+06</td>\n",
       "      <td>1.176958e+08</td>\n",
       "      <td>-1.089109e+08</td>\n",
       "      <td>-1.089109e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.089109e+08</td>\n",
       "      <td>-1.089109e+08</td>\n",
       "      <td>16</td>\n",
       "      <td>-0.001778</td>\n",
       "      <td>1.165422e+08</td>\n",
       "      <td>-1.085976e+08</td>\n",
       "      <td>-1.085976e+08</td>\n",
       "      <td>26</td>\n",
       "      <td>[{u'commission': None, u'amount': 56031, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-10 21:00:00+00:00</th>\n",
       "      <td>1.625211</td>\n",
       "      <td>-0.232764</td>\n",
       "      <td>-0.856583</td>\n",
       "      <td>0.006179</td>\n",
       "      <td>0.164681</td>\n",
       "      <td>-4.639212</td>\n",
       "      <td>2.353596e+07</td>\n",
       "      <td>1.412317e+08</td>\n",
       "      <td>-1.335594e+08</td>\n",
       "      <td>-1.335594e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.335594e+08</td>\n",
       "      <td>-1.335594e+08</td>\n",
       "      <td>23</td>\n",
       "      <td>-1.023983</td>\n",
       "      <td>1.176958e+08</td>\n",
       "      <td>-1.089109e+08</td>\n",
       "      <td>-1.089109e+08</td>\n",
       "      <td>27</td>\n",
       "      <td>[{u'commission': None, u'amount': 118050, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-11 21:00:00+00:00</th>\n",
       "      <td>1.793481</td>\n",
       "      <td>-0.026550</td>\n",
       "      <td>1.615128</td>\n",
       "      <td>0.006763</td>\n",
       "      <td>0.161605</td>\n",
       "      <td>-4.610770</td>\n",
       "      <td>-1.319986e+06</td>\n",
       "      <td>1.399118e+08</td>\n",
       "      <td>-1.301772e+08</td>\n",
       "      <td>-1.301772e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.301772e+08</td>\n",
       "      <td>-1.301772e+08</td>\n",
       "      <td>22</td>\n",
       "      <td>1.125198</td>\n",
       "      <td>1.412317e+08</td>\n",
       "      <td>-1.335594e+08</td>\n",
       "      <td>-1.335594e+08</td>\n",
       "      <td>28</td>\n",
       "      <td>[{u'commission': None, u'amount': 79162, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-12 21:00:00+00:00</th>\n",
       "      <td>1.852926</td>\n",
       "      <td>-0.211787</td>\n",
       "      <td>0.364636</td>\n",
       "      <td>0.016444</td>\n",
       "      <td>0.161057</td>\n",
       "      <td>-5.086779</td>\n",
       "      <td>6.386867e+06</td>\n",
       "      <td>1.462986e+08</td>\n",
       "      <td>-1.384165e+08</td>\n",
       "      <td>-1.384165e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.384165e+08</td>\n",
       "      <td>-1.384165e+08</td>\n",
       "      <td>21</td>\n",
       "      <td>-0.336516</td>\n",
       "      <td>1.399118e+08</td>\n",
       "      <td>-1.301772e+08</td>\n",
       "      <td>-1.301772e+08</td>\n",
       "      <td>29</td>\n",
       "      <td>[{u'commission': None, u'amount': 89169, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-02-13 21:00:00+00:00</th>\n",
       "      <td>1.824715</td>\n",
       "      <td>-0.180197</td>\n",
       "      <td>0.852214</td>\n",
       "      <td>0.020628</td>\n",
       "      <td>0.158581</td>\n",
       "      <td>-5.017057</td>\n",
       "      <td>6.461824e+05</td>\n",
       "      <td>1.469448e+08</td>\n",
       "      <td>-1.387468e+08</td>\n",
       "      <td>-1.387468e+08</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.387468e+08</td>\n",
       "      <td>-1.387468e+08</td>\n",
       "      <td>20</td>\n",
       "      <td>-0.056628</td>\n",
       "      <td>1.462986e+08</td>\n",
       "      <td>-1.384165e+08</td>\n",
       "      <td>-1.384165e+08</td>\n",
       "      <td>30</td>\n",
       "      <td>[{u'commission': None, u'amount': 80374, u'sid...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-16 21:00:00+00:00</th>\n",
       "      <td>33.951485</td>\n",
       "      <td>39.589868</td>\n",
       "      <td>-8.949684</td>\n",
       "      <td>0.330488</td>\n",
       "      <td>0.124813</td>\n",
       "      <td>-1.088464</td>\n",
       "      <td>1.419236e+08</td>\n",
       "      <td>-1.523342e+10</td>\n",
       "      <td>1.563931e+10</td>\n",
       "      <td>1.563931e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.373486e+09</td>\n",
       "      <td>-5.373486e+09</td>\n",
       "      <td>63</td>\n",
       "      <td>-0.351605</td>\n",
       "      <td>-1.537534e+10</td>\n",
       "      <td>1.554679e+10</td>\n",
       "      <td>1.554679e+10</td>\n",
       "      <td>726</td>\n",
       "      <td>[{u'commission': None, u'amount': -78487, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-17 21:00:00+00:00</th>\n",
       "      <td>33.928715</td>\n",
       "      <td>52.284706</td>\n",
       "      <td>-8.827336</td>\n",
       "      <td>0.326578</td>\n",
       "      <td>0.124743</td>\n",
       "      <td>-1.114315</td>\n",
       "      <td>5.618244e+07</td>\n",
       "      <td>-1.517723e+10</td>\n",
       "      <td>1.571008e+10</td>\n",
       "      <td>1.571008e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.460552e+09</td>\n",
       "      <td>-5.460552e+09</td>\n",
       "      <td>63</td>\n",
       "      <td>-0.347155</td>\n",
       "      <td>-1.523342e+10</td>\n",
       "      <td>1.563931e+10</td>\n",
       "      <td>1.563931e+10</td>\n",
       "      <td>727</td>\n",
       "      <td>[{u'commission': None, u'amount': -57948, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-20 21:00:00+00:00</th>\n",
       "      <td>33.905597</td>\n",
       "      <td>61.564659</td>\n",
       "      <td>-8.754910</td>\n",
       "      <td>0.328841</td>\n",
       "      <td>0.124660</td>\n",
       "      <td>-1.108265</td>\n",
       "      <td>3.356024e+08</td>\n",
       "      <td>-1.484163e+10</td>\n",
       "      <td>1.546728e+10</td>\n",
       "      <td>1.546728e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.526415e+09</td>\n",
       "      <td>-5.526415e+09</td>\n",
       "      <td>61</td>\n",
       "      <td>-0.344576</td>\n",
       "      <td>-1.517723e+10</td>\n",
       "      <td>1.571008e+10</td>\n",
       "      <td>1.571008e+10</td>\n",
       "      <td>728</td>\n",
       "      <td>[{u'commission': None, u'amount': -75139, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-21 21:00:00+00:00</th>\n",
       "      <td>33.882365</td>\n",
       "      <td>66.303987</td>\n",
       "      <td>-8.715946</td>\n",
       "      <td>0.337536</td>\n",
       "      <td>0.124626</td>\n",
       "      <td>-1.092223</td>\n",
       "      <td>4.120984e+07</td>\n",
       "      <td>-1.480042e+10</td>\n",
       "      <td>1.547346e+10</td>\n",
       "      <td>1.547346e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.609237e+09</td>\n",
       "      <td>-5.609237e+09</td>\n",
       "      <td>66</td>\n",
       "      <td>-0.343322</td>\n",
       "      <td>-1.484163e+10</td>\n",
       "      <td>1.546728e+10</td>\n",
       "      <td>1.546728e+10</td>\n",
       "      <td>729</td>\n",
       "      <td>[{u'commission': None, u'amount': -77692, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-22 21:00:00+00:00</th>\n",
       "      <td>33.859118</td>\n",
       "      <td>63.235309</td>\n",
       "      <td>-8.720117</td>\n",
       "      <td>0.336352</td>\n",
       "      <td>0.124543</td>\n",
       "      <td>-1.091873</td>\n",
       "      <td>2.120480e+07</td>\n",
       "      <td>-1.477922e+10</td>\n",
       "      <td>1.542157e+10</td>\n",
       "      <td>1.542157e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.635541e+09</td>\n",
       "      <td>-5.635541e+09</td>\n",
       "      <td>66</td>\n",
       "      <td>-0.343698</td>\n",
       "      <td>-1.480042e+10</td>\n",
       "      <td>1.547346e+10</td>\n",
       "      <td>1.547346e+10</td>\n",
       "      <td>730</td>\n",
       "      <td>[{u'commission': None, u'amount': -70514, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-24 18:00:00+00:00</th>\n",
       "      <td>33.835922</td>\n",
       "      <td>59.420024</td>\n",
       "      <td>-8.727693</td>\n",
       "      <td>0.339439</td>\n",
       "      <td>0.124462</td>\n",
       "      <td>-1.092806</td>\n",
       "      <td>1.890861e+07</td>\n",
       "      <td>-1.476031e+10</td>\n",
       "      <td>1.536451e+10</td>\n",
       "      <td>1.536451e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.691530e+09</td>\n",
       "      <td>-5.691530e+09</td>\n",
       "      <td>66</td>\n",
       "      <td>-0.344260</td>\n",
       "      <td>-1.477922e+10</td>\n",
       "      <td>1.542157e+10</td>\n",
       "      <td>1.542157e+10</td>\n",
       "      <td>731</td>\n",
       "      <td>[{u'commission': None, u'amount': -42427, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-27 21:00:00+00:00</th>\n",
       "      <td>33.812842</td>\n",
       "      <td>64.432157</td>\n",
       "      <td>-8.687137</td>\n",
       "      <td>0.338770</td>\n",
       "      <td>0.124378</td>\n",
       "      <td>-1.095229</td>\n",
       "      <td>4.495004e+07</td>\n",
       "      <td>-1.471536e+10</td>\n",
       "      <td>1.536968e+10</td>\n",
       "      <td>1.536968e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.711983e+09</td>\n",
       "      <td>-5.711983e+09</td>\n",
       "      <td>65</td>\n",
       "      <td>-0.342912</td>\n",
       "      <td>-1.476031e+10</td>\n",
       "      <td>1.536451e+10</td>\n",
       "      <td>1.536451e+10</td>\n",
       "      <td>732</td>\n",
       "      <td>[{u'commission': None, u'amount': -92039, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-28 21:00:00+00:00</th>\n",
       "      <td>33.789985</td>\n",
       "      <td>76.586274</td>\n",
       "      <td>-8.613173</td>\n",
       "      <td>0.352352</td>\n",
       "      <td>0.124424</td>\n",
       "      <td>-1.045316</td>\n",
       "      <td>2.069234e+08</td>\n",
       "      <td>-1.450843e+10</td>\n",
       "      <td>1.528430e+10</td>\n",
       "      <td>1.528430e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-5.995670e+09</td>\n",
       "      <td>-5.995670e+09</td>\n",
       "      <td>69</td>\n",
       "      <td>-0.340190</td>\n",
       "      <td>-1.471536e+10</td>\n",
       "      <td>1.536968e+10</td>\n",
       "      <td>1.536968e+10</td>\n",
       "      <td>733</td>\n",
       "      <td>[{u'commission': None, u'amount': -85669, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-29 21:00:00+00:00</th>\n",
       "      <td>33.766936</td>\n",
       "      <td>76.952488</td>\n",
       "      <td>-8.599937</td>\n",
       "      <td>0.351529</td>\n",
       "      <td>0.124340</td>\n",
       "      <td>-1.046210</td>\n",
       "      <td>3.858724e+08</td>\n",
       "      <td>-1.412256e+10</td>\n",
       "      <td>1.490209e+10</td>\n",
       "      <td>1.490209e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.295564e+09</td>\n",
       "      <td>-6.295564e+09</td>\n",
       "      <td>69</td>\n",
       "      <td>-0.339895</td>\n",
       "      <td>-1.450843e+10</td>\n",
       "      <td>1.528430e+10</td>\n",
       "      <td>1.528430e+10</td>\n",
       "      <td>734</td>\n",
       "      <td>[{u'commission': None, u'amount': -90061, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-11-30 21:00:00+00:00</th>\n",
       "      <td>33.744030</td>\n",
       "      <td>85.367109</td>\n",
       "      <td>-8.551265</td>\n",
       "      <td>0.363361</td>\n",
       "      <td>0.124351</td>\n",
       "      <td>-1.018333</td>\n",
       "      <td>2.170061e+08</td>\n",
       "      <td>-1.390556e+10</td>\n",
       "      <td>1.476923e+10</td>\n",
       "      <td>1.476923e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.613459e+09</td>\n",
       "      <td>-6.613459e+09</td>\n",
       "      <td>69</td>\n",
       "      <td>-0.338219</td>\n",
       "      <td>-1.412256e+10</td>\n",
       "      <td>1.490209e+10</td>\n",
       "      <td>1.490209e+10</td>\n",
       "      <td>735</td>\n",
       "      <td>[{u'commission': None, u'amount': -164633, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-01 21:00:00+00:00</th>\n",
       "      <td>33.721106</td>\n",
       "      <td>90.010649</td>\n",
       "      <td>-8.521419</td>\n",
       "      <td>0.360532</td>\n",
       "      <td>0.124275</td>\n",
       "      <td>-1.023129</td>\n",
       "      <td>1.975236e+08</td>\n",
       "      <td>-1.370803e+10</td>\n",
       "      <td>1.461814e+10</td>\n",
       "      <td>1.461814e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.786832e+09</td>\n",
       "      <td>-6.786832e+09</td>\n",
       "      <td>69</td>\n",
       "      <td>-0.337271</td>\n",
       "      <td>-1.390556e+10</td>\n",
       "      <td>1.476923e+10</td>\n",
       "      <td>1.476923e+10</td>\n",
       "      <td>736</td>\n",
       "      <td>[{u'commission': None, u'amount': -116333, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-04 21:00:00+00:00</th>\n",
       "      <td>33.698210</td>\n",
       "      <td>81.252098</td>\n",
       "      <td>-8.543449</td>\n",
       "      <td>0.358885</td>\n",
       "      <td>0.124195</td>\n",
       "      <td>-1.020788</td>\n",
       "      <td>6.650693e+07</td>\n",
       "      <td>-1.364153e+10</td>\n",
       "      <td>1.446405e+10</td>\n",
       "      <td>1.446405e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.801193e+09</td>\n",
       "      <td>-6.801193e+09</td>\n",
       "      <td>69</td>\n",
       "      <td>-0.338327</td>\n",
       "      <td>-1.370803e+10</td>\n",
       "      <td>1.461814e+10</td>\n",
       "      <td>1.461814e+10</td>\n",
       "      <td>737</td>\n",
       "      <td>[{u'commission': None, u'amount': -107525, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-05 21:00:00+00:00</th>\n",
       "      <td>33.675391</td>\n",
       "      <td>70.198253</td>\n",
       "      <td>-8.580053</td>\n",
       "      <td>0.353998</td>\n",
       "      <td>0.124133</td>\n",
       "      <td>-1.011455</td>\n",
       "      <td>1.666857e+07</td>\n",
       "      <td>-1.362486e+10</td>\n",
       "      <td>1.433684e+10</td>\n",
       "      <td>1.433684e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.836817e+09</td>\n",
       "      <td>-6.836817e+09</td>\n",
       "      <td>79</td>\n",
       "      <td>-0.339890</td>\n",
       "      <td>-1.364153e+10</td>\n",
       "      <td>1.446405e+10</td>\n",
       "      <td>1.446405e+10</td>\n",
       "      <td>738</td>\n",
       "      <td>[{u'commission': None, u'amount': -67819, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-06 21:00:00+00:00</th>\n",
       "      <td>33.652598</td>\n",
       "      <td>62.222336</td>\n",
       "      <td>-8.606626</td>\n",
       "      <td>0.354256</td>\n",
       "      <td>0.124049</td>\n",
       "      <td>-1.011022</td>\n",
       "      <td>-3.390811e+06</td>\n",
       "      <td>-1.362825e+10</td>\n",
       "      <td>1.426047e+10</td>\n",
       "      <td>1.426047e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.868267e+09</td>\n",
       "      <td>-6.868267e+09</td>\n",
       "      <td>79</td>\n",
       "      <td>-0.341154</td>\n",
       "      <td>-1.362486e+10</td>\n",
       "      <td>1.433684e+10</td>\n",
       "      <td>1.433684e+10</td>\n",
       "      <td>739</td>\n",
       "      <td>[{u'commission': None, u'amount': -75867, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-07 21:00:00+00:00</th>\n",
       "      <td>33.630064</td>\n",
       "      <td>73.873021</td>\n",
       "      <td>-8.532647</td>\n",
       "      <td>0.358526</td>\n",
       "      <td>0.123975</td>\n",
       "      <td>-0.997706</td>\n",
       "      <td>-1.184094e+07</td>\n",
       "      <td>-1.364009e+10</td>\n",
       "      <td>1.438882e+10</td>\n",
       "      <td>1.438882e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.956507e+09</td>\n",
       "      <td>-6.956507e+09</td>\n",
       "      <td>78</td>\n",
       "      <td>-0.338466</td>\n",
       "      <td>-1.362825e+10</td>\n",
       "      <td>1.426047e+10</td>\n",
       "      <td>1.426047e+10</td>\n",
       "      <td>740</td>\n",
       "      <td>[{u'commission': None, u'amount': -76060, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-08 21:00:00+00:00</th>\n",
       "      <td>33.607595</td>\n",
       "      <td>88.324963</td>\n",
       "      <td>-8.456570</td>\n",
       "      <td>0.365934</td>\n",
       "      <td>0.123925</td>\n",
       "      <td>-0.971940</td>\n",
       "      <td>-7.517962e+06</td>\n",
       "      <td>-1.364761e+10</td>\n",
       "      <td>1.454086e+10</td>\n",
       "      <td>1.454086e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-6.971974e+09</td>\n",
       "      <td>-6.971974e+09</td>\n",
       "      <td>77</td>\n",
       "      <td>-0.335666</td>\n",
       "      <td>-1.364009e+10</td>\n",
       "      <td>1.438882e+10</td>\n",
       "      <td>1.438882e+10</td>\n",
       "      <td>741</td>\n",
       "      <td>[{u'commission': None, u'amount': -48480, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-11 21:00:00+00:00</th>\n",
       "      <td>33.584911</td>\n",
       "      <td>86.415265</td>\n",
       "      <td>-8.451538</td>\n",
       "      <td>0.370050</td>\n",
       "      <td>0.123851</td>\n",
       "      <td>-0.971083</td>\n",
       "      <td>4.043812e+07</td>\n",
       "      <td>-1.360717e+10</td>\n",
       "      <td>1.448132e+10</td>\n",
       "      <td>1.448132e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.056728e+09</td>\n",
       "      <td>-7.056728e+09</td>\n",
       "      <td>77</td>\n",
       "      <td>-0.335724</td>\n",
       "      <td>-1.364761e+10</td>\n",
       "      <td>1.454086e+10</td>\n",
       "      <td>1.454086e+10</td>\n",
       "      <td>742</td>\n",
       "      <td>[{u'commission': None, u'amount': -138572, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-12 21:00:00+00:00</th>\n",
       "      <td>33.562277</td>\n",
       "      <td>86.214671</td>\n",
       "      <td>-8.440470</td>\n",
       "      <td>0.372467</td>\n",
       "      <td>0.123770</td>\n",
       "      <td>-0.970128</td>\n",
       "      <td>7.855542e+07</td>\n",
       "      <td>-1.352861e+10</td>\n",
       "      <td>1.440076e+10</td>\n",
       "      <td>1.440076e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.111451e+09</td>\n",
       "      <td>-7.111451e+09</td>\n",
       "      <td>81</td>\n",
       "      <td>-0.335528</td>\n",
       "      <td>-1.360717e+10</td>\n",
       "      <td>1.448132e+10</td>\n",
       "      <td>1.448132e+10</td>\n",
       "      <td>743</td>\n",
       "      <td>[{u'commission': None, u'amount': -160235, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-13 21:00:00+00:00</th>\n",
       "      <td>33.539706</td>\n",
       "      <td>89.107954</td>\n",
       "      <td>-8.417829</td>\n",
       "      <td>0.372313</td>\n",
       "      <td>0.123687</td>\n",
       "      <td>-0.970966</td>\n",
       "      <td>6.538729e+07</td>\n",
       "      <td>-1.346323e+10</td>\n",
       "      <td>1.436431e+10</td>\n",
       "      <td>1.436431e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.229208e+09</td>\n",
       "      <td>-7.229208e+09</td>\n",
       "      <td>81</td>\n",
       "      <td>-0.334862</td>\n",
       "      <td>-1.352861e+10</td>\n",
       "      <td>1.440076e+10</td>\n",
       "      <td>1.440076e+10</td>\n",
       "      <td>744</td>\n",
       "      <td>[{u'commission': None, u'amount': -153955, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-14 21:00:00+00:00</th>\n",
       "      <td>33.517271</td>\n",
       "      <td>72.627524</td>\n",
       "      <td>-8.471486</td>\n",
       "      <td>0.366705</td>\n",
       "      <td>0.123632</td>\n",
       "      <td>-0.955541</td>\n",
       "      <td>9.720139e+07</td>\n",
       "      <td>-1.336602e+10</td>\n",
       "      <td>1.410230e+10</td>\n",
       "      <td>1.410230e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.275907e+09</td>\n",
       "      <td>-7.275907e+09</td>\n",
       "      <td>80</td>\n",
       "      <td>-0.337064</td>\n",
       "      <td>-1.346323e+10</td>\n",
       "      <td>1.436431e+10</td>\n",
       "      <td>1.436431e+10</td>\n",
       "      <td>745</td>\n",
       "      <td>[{u'commission': None, u'amount': -134565, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-15 21:00:00+00:00</th>\n",
       "      <td>33.494964</td>\n",
       "      <td>84.625461</td>\n",
       "      <td>-8.406515</td>\n",
       "      <td>0.378016</td>\n",
       "      <td>0.123633</td>\n",
       "      <td>-0.920173</td>\n",
       "      <td>1.562758e+08</td>\n",
       "      <td>-1.320975e+10</td>\n",
       "      <td>1.406600e+10</td>\n",
       "      <td>1.406600e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.518819e+09</td>\n",
       "      <td>-7.518819e+09</td>\n",
       "      <td>80</td>\n",
       "      <td>-0.334674</td>\n",
       "      <td>-1.336602e+10</td>\n",
       "      <td>1.410230e+10</td>\n",
       "      <td>1.410230e+10</td>\n",
       "      <td>746</td>\n",
       "      <td>[{u'commission': None, u'amount': -198249, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-18 21:00:00+00:00</th>\n",
       "      <td>33.472718</td>\n",
       "      <td>99.239650</td>\n",
       "      <td>-8.338930</td>\n",
       "      <td>0.386755</td>\n",
       "      <td>0.123597</td>\n",
       "      <td>-0.892917</td>\n",
       "      <td>1.019541e+08</td>\n",
       "      <td>-1.310779e+10</td>\n",
       "      <td>1.411019e+10</td>\n",
       "      <td>1.411019e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.728746e+09</td>\n",
       "      <td>-7.728746e+09</td>\n",
       "      <td>80</td>\n",
       "      <td>-0.332185</td>\n",
       "      <td>-1.320975e+10</td>\n",
       "      <td>1.406600e+10</td>\n",
       "      <td>1.406600e+10</td>\n",
       "      <td>747</td>\n",
       "      <td>[{u'commission': None, u'amount': -217061, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-19 21:00:00+00:00</th>\n",
       "      <td>33.450313</td>\n",
       "      <td>91.996413</td>\n",
       "      <td>-8.353753</td>\n",
       "      <td>0.381429</td>\n",
       "      <td>0.123539</td>\n",
       "      <td>-0.888866</td>\n",
       "      <td>8.115382e+07</td>\n",
       "      <td>-1.302664e+10</td>\n",
       "      <td>1.395660e+10</td>\n",
       "      <td>1.395660e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.786011e+09</td>\n",
       "      <td>-7.786011e+09</td>\n",
       "      <td>85</td>\n",
       "      <td>-0.332921</td>\n",
       "      <td>-1.310779e+10</td>\n",
       "      <td>1.411019e+10</td>\n",
       "      <td>1.411019e+10</td>\n",
       "      <td>748</td>\n",
       "      <td>[{u'commission': None, u'amount': -266117, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-20 21:00:00+00:00</th>\n",
       "      <td>33.427967</td>\n",
       "      <td>94.895976</td>\n",
       "      <td>-8.332105</td>\n",
       "      <td>0.380705</td>\n",
       "      <td>0.123458</td>\n",
       "      <td>-0.890256</td>\n",
       "      <td>8.862703e+07</td>\n",
       "      <td>-1.293801e+10</td>\n",
       "      <td>1.389697e+10</td>\n",
       "      <td>1.389697e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.873819e+09</td>\n",
       "      <td>-7.873819e+09</td>\n",
       "      <td>84</td>\n",
       "      <td>-0.332286</td>\n",
       "      <td>-1.302664e+10</td>\n",
       "      <td>1.395660e+10</td>\n",
       "      <td>1.395660e+10</td>\n",
       "      <td>749</td>\n",
       "      <td>[{u'commission': None, u'amount': -136681, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-21 21:00:00+00:00</th>\n",
       "      <td>33.405765</td>\n",
       "      <td>106.530348</td>\n",
       "      <td>-8.280258</td>\n",
       "      <td>0.383549</td>\n",
       "      <td>0.123379</td>\n",
       "      <td>-0.884743</td>\n",
       "      <td>1.286297e+08</td>\n",
       "      <td>-1.280938e+10</td>\n",
       "      <td>1.388469e+10</td>\n",
       "      <td>1.388469e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-7.980043e+09</td>\n",
       "      <td>-7.980043e+09</td>\n",
       "      <td>83</td>\n",
       "      <td>-0.330457</td>\n",
       "      <td>-1.293801e+10</td>\n",
       "      <td>1.389697e+10</td>\n",
       "      <td>1.389697e+10</td>\n",
       "      <td>750</td>\n",
       "      <td>[{u'commission': None, u'amount': -133495, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-22 21:00:00+00:00</th>\n",
       "      <td>33.383487</td>\n",
       "      <td>103.433840</td>\n",
       "      <td>-8.278966</td>\n",
       "      <td>0.383187</td>\n",
       "      <td>0.123298</td>\n",
       "      <td>-0.884804</td>\n",
       "      <td>1.169665e+08</td>\n",
       "      <td>-1.269242e+10</td>\n",
       "      <td>1.373676e+10</td>\n",
       "      <td>1.373676e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.103919e+09</td>\n",
       "      <td>-8.103919e+09</td>\n",
       "      <td>83</td>\n",
       "      <td>-0.330618</td>\n",
       "      <td>-1.280938e+10</td>\n",
       "      <td>1.388469e+10</td>\n",
       "      <td>1.388469e+10</td>\n",
       "      <td>751</td>\n",
       "      <td>[{u'commission': None, u'amount': -156981, u's...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-26 21:00:00+00:00</th>\n",
       "      <td>33.361312</td>\n",
       "      <td>111.259715</td>\n",
       "      <td>-8.242747</td>\n",
       "      <td>0.381533</td>\n",
       "      <td>0.123219</td>\n",
       "      <td>-0.888711</td>\n",
       "      <td>5.994340e+07</td>\n",
       "      <td>-1.263247e+10</td>\n",
       "      <td>1.375507e+10</td>\n",
       "      <td>1.375507e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.134393e+09</td>\n",
       "      <td>-8.134393e+09</td>\n",
       "      <td>83</td>\n",
       "      <td>-0.329407</td>\n",
       "      <td>-1.269242e+10</td>\n",
       "      <td>1.373676e+10</td>\n",
       "      <td>1.373676e+10</td>\n",
       "      <td>752</td>\n",
       "      <td>[{u'commission': None, u'amount': -85662, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-27 21:00:00+00:00</th>\n",
       "      <td>33.339130</td>\n",
       "      <td>111.627362</td>\n",
       "      <td>-8.230562</td>\n",
       "      <td>0.382205</td>\n",
       "      <td>0.123137</td>\n",
       "      <td>-0.888690</td>\n",
       "      <td>7.604269e+07</td>\n",
       "      <td>-1.255643e+10</td>\n",
       "      <td>1.368271e+10</td>\n",
       "      <td>1.368271e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.206119e+09</td>\n",
       "      <td>-8.206119e+09</td>\n",
       "      <td>91</td>\n",
       "      <td>-0.329145</td>\n",
       "      <td>-1.263247e+10</td>\n",
       "      <td>1.375507e+10</td>\n",
       "      <td>1.375507e+10</td>\n",
       "      <td>753</td>\n",
       "      <td>[{u'commission': None, u'amount': -52970, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-28 21:00:00+00:00</th>\n",
       "      <td>33.316985</td>\n",
       "      <td>108.799003</td>\n",
       "      <td>-8.227467</td>\n",
       "      <td>0.385049</td>\n",
       "      <td>0.123059</td>\n",
       "      <td>-0.888359</td>\n",
       "      <td>9.292686e+07</td>\n",
       "      <td>-1.246350e+10</td>\n",
       "      <td>1.356149e+10</td>\n",
       "      <td>1.356149e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.280849e+09</td>\n",
       "      <td>-8.280849e+09</td>\n",
       "      <td>91</td>\n",
       "      <td>-0.329258</td>\n",
       "      <td>-1.255643e+10</td>\n",
       "      <td>1.368271e+10</td>\n",
       "      <td>1.368271e+10</td>\n",
       "      <td>754</td>\n",
       "      <td>[{u'commission': None, u'amount': -46213, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-29 21:00:00+00:00</th>\n",
       "      <td>33.294885</td>\n",
       "      <td>103.729294</td>\n",
       "      <td>-8.233280</td>\n",
       "      <td>0.379826</td>\n",
       "      <td>0.123002</td>\n",
       "      <td>-0.886783</td>\n",
       "      <td>7.515320e+07</td>\n",
       "      <td>-1.238835e+10</td>\n",
       "      <td>1.343564e+10</td>\n",
       "      <td>1.343564e+10</td>\n",
       "      <td>...</td>\n",
       "      <td>-8.294057e+09</td>\n",
       "      <td>-8.294057e+09</td>\n",
       "      <td>91</td>\n",
       "      <td>-0.329649</td>\n",
       "      <td>-1.246350e+10</td>\n",
       "      <td>1.356149e+10</td>\n",
       "      <td>1.356149e+10</td>\n",
       "      <td>755</td>\n",
       "      <td>[{u'commission': None, u'amount': -47405, u'si...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>755 rows × 39 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                           algo_volatility  algorithm_period_return     alpha  \\\n",
       "2015-01-02 21:00:00+00:00              NaN                 0.000000       NaN   \n",
       "2015-01-05 21:00:00+00:00         0.001658                -0.000148  0.001137   \n",
       "2015-01-06 21:00:00+00:00         0.041095                -0.004703 -0.369692   \n",
       "2015-01-07 21:00:00+00:00         0.092916                -0.017128 -1.422556   \n",
       "2015-01-08 21:00:00+00:00         0.219120                -0.049569 -2.445576   \n",
       "2015-01-09 21:00:00+00:00         0.432739                -0.115691 -5.095987   \n",
       "2015-01-12 21:00:00+00:00         0.650275                -0.057214 -2.310900   \n",
       "2015-01-13 21:00:00+00:00         0.620539                -0.039174 -1.498151   \n",
       "2015-01-14 21:00:00+00:00         0.684345                -0.109137 -3.344705   \n",
       "2015-01-15 21:00:00+00:00         0.891547                -0.010570 -0.894328   \n",
       "2015-01-16 21:00:00+00:00         0.997364                -0.119502 -3.411624   \n",
       "2015-01-20 21:00:00+00:00         0.951020                -0.130281 -3.278148   \n",
       "2015-01-21 21:00:00+00:00         1.101656                -0.261408 -5.851162   \n",
       "2015-01-22 21:00:00+00:00         1.071080                -0.248171 -4.404805   \n",
       "2015-01-23 21:00:00+00:00         1.110031                -0.186760 -2.936846   \n",
       "2015-01-26 21:00:00+00:00         1.235179                -0.321580 -5.276909   \n",
       "2015-01-27 21:00:00+00:00         1.196141                -0.339522 -5.805218   \n",
       "2015-01-28 21:00:00+00:00         1.304600                -0.248371 -4.243485   \n",
       "2015-01-29 21:00:00+00:00         1.268207                -0.251469 -3.653629   \n",
       "2015-01-30 21:00:00+00:00         1.263830                -0.203276 -3.194634   \n",
       "2015-02-02 21:00:00+00:00         1.235822                -0.186983 -2.258068   \n",
       "2015-02-03 21:00:00+00:00         1.308755                -0.314636 -3.525439   \n",
       "2015-02-04 21:00:00+00:00         1.361430                -0.227216 -2.124213   \n",
       "2015-02-05 21:00:00+00:00         1.428325                -0.356313 -3.400375   \n",
       "2015-02-06 21:00:00+00:00         1.605345                -0.205537 -1.009723   \n",
       "2015-02-09 21:00:00+00:00         1.609758                -0.121516 -0.132270   \n",
       "2015-02-10 21:00:00+00:00         1.625211                -0.232764 -0.856583   \n",
       "2015-02-11 21:00:00+00:00         1.793481                -0.026550  1.615128   \n",
       "2015-02-12 21:00:00+00:00         1.852926                -0.211787  0.364636   \n",
       "2015-02-13 21:00:00+00:00         1.824715                -0.180197  0.852214   \n",
       "...                                    ...                      ...       ...   \n",
       "2017-11-16 21:00:00+00:00        33.951485                39.589868 -8.949684   \n",
       "2017-11-17 21:00:00+00:00        33.928715                52.284706 -8.827336   \n",
       "2017-11-20 21:00:00+00:00        33.905597                61.564659 -8.754910   \n",
       "2017-11-21 21:00:00+00:00        33.882365                66.303987 -8.715946   \n",
       "2017-11-22 21:00:00+00:00        33.859118                63.235309 -8.720117   \n",
       "2017-11-24 18:00:00+00:00        33.835922                59.420024 -8.727693   \n",
       "2017-11-27 21:00:00+00:00        33.812842                64.432157 -8.687137   \n",
       "2017-11-28 21:00:00+00:00        33.789985                76.586274 -8.613173   \n",
       "2017-11-29 21:00:00+00:00        33.766936                76.952488 -8.599937   \n",
       "2017-11-30 21:00:00+00:00        33.744030                85.367109 -8.551265   \n",
       "2017-12-01 21:00:00+00:00        33.721106                90.010649 -8.521419   \n",
       "2017-12-04 21:00:00+00:00        33.698210                81.252098 -8.543449   \n",
       "2017-12-05 21:00:00+00:00        33.675391                70.198253 -8.580053   \n",
       "2017-12-06 21:00:00+00:00        33.652598                62.222336 -8.606626   \n",
       "2017-12-07 21:00:00+00:00        33.630064                73.873021 -8.532647   \n",
       "2017-12-08 21:00:00+00:00        33.607595                88.324963 -8.456570   \n",
       "2017-12-11 21:00:00+00:00        33.584911                86.415265 -8.451538   \n",
       "2017-12-12 21:00:00+00:00        33.562277                86.214671 -8.440470   \n",
       "2017-12-13 21:00:00+00:00        33.539706                89.107954 -8.417829   \n",
       "2017-12-14 21:00:00+00:00        33.517271                72.627524 -8.471486   \n",
       "2017-12-15 21:00:00+00:00        33.494964                84.625461 -8.406515   \n",
       "2017-12-18 21:00:00+00:00        33.472718                99.239650 -8.338930   \n",
       "2017-12-19 21:00:00+00:00        33.450313                91.996413 -8.353753   \n",
       "2017-12-20 21:00:00+00:00        33.427967                94.895976 -8.332105   \n",
       "2017-12-21 21:00:00+00:00        33.405765               106.530348 -8.280258   \n",
       "2017-12-22 21:00:00+00:00        33.383487               103.433840 -8.278966   \n",
       "2017-12-26 21:00:00+00:00        33.361312               111.259715 -8.242747   \n",
       "2017-12-27 21:00:00+00:00        33.339130               111.627362 -8.230562   \n",
       "2017-12-28 21:00:00+00:00        33.316985               108.799003 -8.227467   \n",
       "2017-12-29 21:00:00+00:00        33.294885               103.729294 -8.233280   \n",
       "\n",
       "                           benchmark_period_return  benchmark_volatility  \\\n",
       "2015-01-02 21:00:00+00:00                -0.000535                   NaN   \n",
       "2015-01-05 21:00:00+00:00                -0.018585              0.196709   \n",
       "2015-01-06 21:00:00+00:00                -0.027829              0.139099   \n",
       "2015-01-07 21:00:00+00:00                -0.015715              0.206972   \n",
       "2015-01-08 21:00:00+00:00                 0.001751              0.236040   \n",
       "2015-01-09 21:00:00+00:00                -0.006276              0.218110   \n",
       "2015-01-12 21:00:00+00:00                -0.014061              0.203321   \n",
       "2015-01-13 21:00:00+00:00                -0.016834              0.188301   \n",
       "2015-01-14 21:00:00+00:00                -0.022770              0.177393   \n",
       "2015-01-15 21:00:00+00:00                -0.031722              0.170557   \n",
       "2015-01-16 21:00:00+00:00                -0.019024              0.179592   \n",
       "2015-01-20 21:00:00+00:00                -0.016956              0.172115   \n",
       "2015-01-21 21:00:00+00:00                -0.011969              0.167211   \n",
       "2015-01-22 21:00:00+00:00                 0.002724              0.173987   \n",
       "2015-01-23 21:00:00+00:00                -0.002773              0.169297   \n",
       "2015-01-26 21:00:00+00:00                -0.000438              0.163851   \n",
       "2015-01-27 21:00:00+00:00                -0.013623              0.166604   \n",
       "2015-01-28 21:00:00+00:00                -0.026272              0.167820   \n",
       "2015-01-29 21:00:00+00:00                -0.017271              0.167657   \n",
       "2015-01-30 21:00:00+00:00                -0.029630              0.168398   \n",
       "2015-02-02 21:00:00+00:00                -0.017613              0.170987   \n",
       "2015-02-03 21:00:00+00:00                -0.003406              0.174668   \n",
       "2015-02-04 21:00:00+00:00                -0.007201              0.171094   \n",
       "2015-02-05 21:00:00+00:00                 0.002821              0.170663   \n",
       "2015-02-06 21:00:00+00:00                 0.000048              0.167330   \n",
       "2015-02-09 21:00:00+00:00                -0.004427              0.164555   \n",
       "2015-02-10 21:00:00+00:00                 0.006179              0.164681   \n",
       "2015-02-11 21:00:00+00:00                 0.006763              0.161605   \n",
       "2015-02-12 21:00:00+00:00                 0.016444              0.161057   \n",
       "2015-02-13 21:00:00+00:00                 0.020628              0.158581   \n",
       "...                                            ...                   ...   \n",
       "2017-11-16 21:00:00+00:00                 0.330488              0.124813   \n",
       "2017-11-17 21:00:00+00:00                 0.326578              0.124743   \n",
       "2017-11-20 21:00:00+00:00                 0.328841              0.124660   \n",
       "2017-11-21 21:00:00+00:00                 0.337536              0.124626   \n",
       "2017-11-22 21:00:00+00:00                 0.336352              0.124543   \n",
       "2017-11-24 18:00:00+00:00                 0.339439              0.124462   \n",
       "2017-11-27 21:00:00+00:00                 0.338770              0.124378   \n",
       "2017-11-28 21:00:00+00:00                 0.352352              0.124424   \n",
       "2017-11-29 21:00:00+00:00                 0.351529              0.124340   \n",
       "2017-11-30 21:00:00+00:00                 0.363361              0.124351   \n",
       "2017-12-01 21:00:00+00:00                 0.360532              0.124275   \n",
       "2017-12-04 21:00:00+00:00                 0.358885              0.124195   \n",
       "2017-12-05 21:00:00+00:00                 0.353998              0.124133   \n",
       "2017-12-06 21:00:00+00:00                 0.354256              0.124049   \n",
       "2017-12-07 21:00:00+00:00                 0.358526              0.123975   \n",
       "2017-12-08 21:00:00+00:00                 0.365934              0.123925   \n",
       "2017-12-11 21:00:00+00:00                 0.370050              0.123851   \n",
       "2017-12-12 21:00:00+00:00                 0.372467              0.123770   \n",
       "2017-12-13 21:00:00+00:00                 0.372313              0.123687   \n",
       "2017-12-14 21:00:00+00:00                 0.366705              0.123632   \n",
       "2017-12-15 21:00:00+00:00                 0.378016              0.123633   \n",
       "2017-12-18 21:00:00+00:00                 0.386755              0.123597   \n",
       "2017-12-19 21:00:00+00:00                 0.381429              0.123539   \n",
       "2017-12-20 21:00:00+00:00                 0.380705              0.123458   \n",
       "2017-12-21 21:00:00+00:00                 0.383549              0.123379   \n",
       "2017-12-22 21:00:00+00:00                 0.383187              0.123298   \n",
       "2017-12-26 21:00:00+00:00                 0.381533              0.123219   \n",
       "2017-12-27 21:00:00+00:00                 0.382205              0.123137   \n",
       "2017-12-28 21:00:00+00:00                 0.385049              0.123059   \n",
       "2017-12-29 21:00:00+00:00                 0.379826              0.123002   \n",
       "\n",
       "                               beta  capital_used   ending_cash  \\\n",
       "2015-01-02 21:00:00+00:00       NaN  0.000000e+00  1.000000e+07   \n",
       "2015-01-05 21:00:00+00:00  0.008430  4.557735e+06  1.455774e+07   \n",
       "2015-01-06 21:00:00+00:00  0.010798  1.392954e+07  2.848728e+07   \n",
       "2015-01-07 21:00:00+00:00 -0.346724  5.821402e+06  3.430868e+07   \n",
       "2015-01-08 21:00:00+00:00 -0.761751  4.882509e+06  3.919119e+07   \n",
       "2015-01-09 21:00:00+00:00 -0.269478  4.057730e+06  4.324892e+07   \n",
       "2015-01-12 21:00:00+00:00 -0.772985  1.669051e+06  4.491797e+07   \n",
       "2015-01-13 21:00:00+00:00 -0.792991  4.810981e+06  4.972895e+07   \n",
       "2015-01-14 21:00:00+00:00 -0.539288  8.473548e+05  5.057631e+07   \n",
       "2015-01-15 21:00:00+00:00 -1.225731 -9.093704e+05  4.966693e+07   \n",
       "2015-01-16 21:00:00+00:00 -2.271973  1.540644e+06  5.120758e+07   \n",
       "2015-01-20 21:00:00+00:00 -2.255599  3.370567e+06  5.457815e+07   \n",
       "2015-01-21 21:00:00+00:00 -2.819883  1.377785e+07  6.835600e+07   \n",
       "2015-01-22 21:00:00+00:00 -2.042067  7.649323e+06  7.600532e+07   \n",
       "2015-01-23 21:00:00+00:00 -2.337669  7.143408e+06  8.314873e+07   \n",
       "2015-01-26 21:00:00+00:00 -2.553404  6.568951e+06  8.971768e+07   \n",
       "2015-01-27 21:00:00+00:00 -2.276883  3.765221e+06  9.348290e+07   \n",
       "2015-01-28 21:00:00+00:00 -3.067903 -6.870838e+06  8.661206e+07   \n",
       "2015-01-29 21:00:00+00:00 -2.861086 -2.009625e+06  8.460244e+07   \n",
       "2015-01-30 21:00:00+00:00 -3.084339  2.145741e+06  8.674818e+07   \n",
       "2015-02-02 21:00:00+00:00 -2.679374  2.432214e+06  8.918039e+07   \n",
       "2015-02-03 21:00:00+00:00 -3.305288  1.861897e+07  1.077994e+08   \n",
       "2015-02-04 21:00:00+00:00 -3.484392  5.884296e+06  1.136837e+08   \n",
       "2015-02-05 21:00:00+00:00 -3.945173  1.839498e+06  1.155232e+08   \n",
       "2015-02-06 21:00:00+00:00 -4.195653  1.019052e+06  1.165422e+08   \n",
       "2015-02-09 21:00:00+00:00 -4.343213  1.153572e+06  1.176958e+08   \n",
       "2015-02-10 21:00:00+00:00 -4.639212  2.353596e+07  1.412317e+08   \n",
       "2015-02-11 21:00:00+00:00 -4.610770 -1.319986e+06  1.399118e+08   \n",
       "2015-02-12 21:00:00+00:00 -5.086779  6.386867e+06  1.462986e+08   \n",
       "2015-02-13 21:00:00+00:00 -5.017057  6.461824e+05  1.469448e+08   \n",
       "...                             ...           ...           ...   \n",
       "2017-11-16 21:00:00+00:00 -1.088464  1.419236e+08 -1.523342e+10   \n",
       "2017-11-17 21:00:00+00:00 -1.114315  5.618244e+07 -1.517723e+10   \n",
       "2017-11-20 21:00:00+00:00 -1.108265  3.356024e+08 -1.484163e+10   \n",
       "2017-11-21 21:00:00+00:00 -1.092223  4.120984e+07 -1.480042e+10   \n",
       "2017-11-22 21:00:00+00:00 -1.091873  2.120480e+07 -1.477922e+10   \n",
       "2017-11-24 18:00:00+00:00 -1.092806  1.890861e+07 -1.476031e+10   \n",
       "2017-11-27 21:00:00+00:00 -1.095229  4.495004e+07 -1.471536e+10   \n",
       "2017-11-28 21:00:00+00:00 -1.045316  2.069234e+08 -1.450843e+10   \n",
       "2017-11-29 21:00:00+00:00 -1.046210  3.858724e+08 -1.412256e+10   \n",
       "2017-11-30 21:00:00+00:00 -1.018333  2.170061e+08 -1.390556e+10   \n",
       "2017-12-01 21:00:00+00:00 -1.023129  1.975236e+08 -1.370803e+10   \n",
       "2017-12-04 21:00:00+00:00 -1.020788  6.650693e+07 -1.364153e+10   \n",
       "2017-12-05 21:00:00+00:00 -1.011455  1.666857e+07 -1.362486e+10   \n",
       "2017-12-06 21:00:00+00:00 -1.011022 -3.390811e+06 -1.362825e+10   \n",
       "2017-12-07 21:00:00+00:00 -0.997706 -1.184094e+07 -1.364009e+10   \n",
       "2017-12-08 21:00:00+00:00 -0.971940 -7.517962e+06 -1.364761e+10   \n",
       "2017-12-11 21:00:00+00:00 -0.971083  4.043812e+07 -1.360717e+10   \n",
       "2017-12-12 21:00:00+00:00 -0.970128  7.855542e+07 -1.352861e+10   \n",
       "2017-12-13 21:00:00+00:00 -0.970966  6.538729e+07 -1.346323e+10   \n",
       "2017-12-14 21:00:00+00:00 -0.955541  9.720139e+07 -1.336602e+10   \n",
       "2017-12-15 21:00:00+00:00 -0.920173  1.562758e+08 -1.320975e+10   \n",
       "2017-12-18 21:00:00+00:00 -0.892917  1.019541e+08 -1.310779e+10   \n",
       "2017-12-19 21:00:00+00:00 -0.888866  8.115382e+07 -1.302664e+10   \n",
       "2017-12-20 21:00:00+00:00 -0.890256  8.862703e+07 -1.293801e+10   \n",
       "2017-12-21 21:00:00+00:00 -0.884743  1.286297e+08 -1.280938e+10   \n",
       "2017-12-22 21:00:00+00:00 -0.884804  1.169665e+08 -1.269242e+10   \n",
       "2017-12-26 21:00:00+00:00 -0.888711  5.994340e+07 -1.263247e+10   \n",
       "2017-12-27 21:00:00+00:00 -0.888690  7.604269e+07 -1.255643e+10   \n",
       "2017-12-28 21:00:00+00:00 -0.888359  9.292686e+07 -1.246350e+10   \n",
       "2017-12-29 21:00:00+00:00 -0.886783  7.515320e+07 -1.238835e+10   \n",
       "\n",
       "                           ending_exposure  ending_value  \\\n",
       "2015-01-02 21:00:00+00:00     0.000000e+00  0.000000e+00   \n",
       "2015-01-05 21:00:00+00:00    -4.559213e+06 -4.559213e+06   \n",
       "2015-01-06 21:00:00+00:00    -1.853431e+07 -1.853431e+07   \n",
       "2015-01-07 21:00:00+00:00    -2.447996e+07 -2.447996e+07   \n",
       "2015-01-08 21:00:00+00:00    -2.968687e+07 -2.968687e+07   \n",
       "2015-01-09 21:00:00+00:00    -3.440583e+07 -3.440583e+07   \n",
       "2015-01-12 21:00:00+00:00    -3.549011e+07 -3.549011e+07   \n",
       "2015-01-13 21:00:00+00:00    -4.012069e+07 -4.012069e+07   \n",
       "2015-01-14 21:00:00+00:00    -4.166767e+07 -4.166767e+07   \n",
       "2015-01-15 21:00:00+00:00    -3.977263e+07 -3.977263e+07   \n",
       "2015-01-16 21:00:00+00:00    -4.240260e+07 -4.240260e+07   \n",
       "2015-01-20 21:00:00+00:00    -4.588095e+07 -4.588095e+07   \n",
       "2015-01-21 21:00:00+00:00    -6.097007e+07 -6.097007e+07   \n",
       "2015-01-22 21:00:00+00:00    -6.848702e+07 -6.848702e+07   \n",
       "2015-01-23 21:00:00+00:00    -7.501632e+07 -7.501632e+07   \n",
       "2015-01-26 21:00:00+00:00    -8.293347e+07 -8.293347e+07   \n",
       "2015-01-27 21:00:00+00:00    -8.687812e+07 -8.687812e+07   \n",
       "2015-01-28 21:00:00+00:00    -7.909577e+07 -7.909577e+07   \n",
       "2015-01-29 21:00:00+00:00    -7.711712e+07 -7.711712e+07   \n",
       "2015-01-30 21:00:00+00:00    -7.878094e+07 -7.878094e+07   \n",
       "2015-02-02 21:00:00+00:00    -8.105022e+07 -8.105022e+07   \n",
       "2015-02-03 21:00:00+00:00    -1.009457e+08 -1.009457e+08   \n",
       "2015-02-04 21:00:00+00:00    -1.059558e+08 -1.059558e+08   \n",
       "2015-02-05 21:00:00+00:00    -1.090863e+08 -1.090863e+08   \n",
       "2015-02-06 21:00:00+00:00    -1.085976e+08 -1.085976e+08   \n",
       "2015-02-09 21:00:00+00:00    -1.089109e+08 -1.089109e+08   \n",
       "2015-02-10 21:00:00+00:00    -1.335594e+08 -1.335594e+08   \n",
       "2015-02-11 21:00:00+00:00    -1.301772e+08 -1.301772e+08   \n",
       "2015-02-12 21:00:00+00:00    -1.384165e+08 -1.384165e+08   \n",
       "2015-02-13 21:00:00+00:00    -1.387468e+08 -1.387468e+08   \n",
       "...                                    ...           ...   \n",
       "2017-11-16 21:00:00+00:00     1.563931e+10  1.563931e+10   \n",
       "2017-11-17 21:00:00+00:00     1.571008e+10  1.571008e+10   \n",
       "2017-11-20 21:00:00+00:00     1.546728e+10  1.546728e+10   \n",
       "2017-11-21 21:00:00+00:00     1.547346e+10  1.547346e+10   \n",
       "2017-11-22 21:00:00+00:00     1.542157e+10  1.542157e+10   \n",
       "2017-11-24 18:00:00+00:00     1.536451e+10  1.536451e+10   \n",
       "2017-11-27 21:00:00+00:00     1.536968e+10  1.536968e+10   \n",
       "2017-11-28 21:00:00+00:00     1.528430e+10  1.528430e+10   \n",
       "2017-11-29 21:00:00+00:00     1.490209e+10  1.490209e+10   \n",
       "2017-11-30 21:00:00+00:00     1.476923e+10  1.476923e+10   \n",
       "2017-12-01 21:00:00+00:00     1.461814e+10  1.461814e+10   \n",
       "2017-12-04 21:00:00+00:00     1.446405e+10  1.446405e+10   \n",
       "2017-12-05 21:00:00+00:00     1.433684e+10  1.433684e+10   \n",
       "2017-12-06 21:00:00+00:00     1.426047e+10  1.426047e+10   \n",
       "2017-12-07 21:00:00+00:00     1.438882e+10  1.438882e+10   \n",
       "2017-12-08 21:00:00+00:00     1.454086e+10  1.454086e+10   \n",
       "2017-12-11 21:00:00+00:00     1.448132e+10  1.448132e+10   \n",
       "2017-12-12 21:00:00+00:00     1.440076e+10  1.440076e+10   \n",
       "2017-12-13 21:00:00+00:00     1.436431e+10  1.436431e+10   \n",
       "2017-12-14 21:00:00+00:00     1.410230e+10  1.410230e+10   \n",
       "2017-12-15 21:00:00+00:00     1.406600e+10  1.406600e+10   \n",
       "2017-12-18 21:00:00+00:00     1.411019e+10  1.411019e+10   \n",
       "2017-12-19 21:00:00+00:00     1.395660e+10  1.395660e+10   \n",
       "2017-12-20 21:00:00+00:00     1.389697e+10  1.389697e+10   \n",
       "2017-12-21 21:00:00+00:00     1.388469e+10  1.388469e+10   \n",
       "2017-12-22 21:00:00+00:00     1.373676e+10  1.373676e+10   \n",
       "2017-12-26 21:00:00+00:00     1.375507e+10  1.375507e+10   \n",
       "2017-12-27 21:00:00+00:00     1.368271e+10  1.368271e+10   \n",
       "2017-12-28 21:00:00+00:00     1.356149e+10  1.356149e+10   \n",
       "2017-12-29 21:00:00+00:00     1.343564e+10  1.343564e+10   \n",
       "\n",
       "                                   ...            short_exposure  \\\n",
       "2015-01-02 21:00:00+00:00          ...              0.000000e+00   \n",
       "2015-01-05 21:00:00+00:00          ...             -4.559213e+06   \n",
       "2015-01-06 21:00:00+00:00          ...             -1.853431e+07   \n",
       "2015-01-07 21:00:00+00:00          ...             -2.447996e+07   \n",
       "2015-01-08 21:00:00+00:00          ...             -2.968687e+07   \n",
       "2015-01-09 21:00:00+00:00          ...             -3.440583e+07   \n",
       "2015-01-12 21:00:00+00:00          ...             -3.549011e+07   \n",
       "2015-01-13 21:00:00+00:00          ...             -4.012069e+07   \n",
       "2015-01-14 21:00:00+00:00          ...             -4.166767e+07   \n",
       "2015-01-15 21:00:00+00:00          ...             -3.977263e+07   \n",
       "2015-01-16 21:00:00+00:00          ...             -4.240260e+07   \n",
       "2015-01-20 21:00:00+00:00          ...             -4.588095e+07   \n",
       "2015-01-21 21:00:00+00:00          ...             -6.097007e+07   \n",
       "2015-01-22 21:00:00+00:00          ...             -6.848702e+07   \n",
       "2015-01-23 21:00:00+00:00          ...             -7.501632e+07   \n",
       "2015-01-26 21:00:00+00:00          ...             -8.293347e+07   \n",
       "2015-01-27 21:00:00+00:00          ...             -8.687812e+07   \n",
       "2015-01-28 21:00:00+00:00          ...             -7.909577e+07   \n",
       "2015-01-29 21:00:00+00:00          ...             -7.711712e+07   \n",
       "2015-01-30 21:00:00+00:00          ...             -7.878094e+07   \n",
       "2015-02-02 21:00:00+00:00          ...             -8.105022e+07   \n",
       "2015-02-03 21:00:00+00:00          ...             -1.009457e+08   \n",
       "2015-02-04 21:00:00+00:00          ...             -1.059558e+08   \n",
       "2015-02-05 21:00:00+00:00          ...             -1.090863e+08   \n",
       "2015-02-06 21:00:00+00:00          ...             -1.085976e+08   \n",
       "2015-02-09 21:00:00+00:00          ...             -1.089109e+08   \n",
       "2015-02-10 21:00:00+00:00          ...             -1.335594e+08   \n",
       "2015-02-11 21:00:00+00:00          ...             -1.301772e+08   \n",
       "2015-02-12 21:00:00+00:00          ...             -1.384165e+08   \n",
       "2015-02-13 21:00:00+00:00          ...             -1.387468e+08   \n",
       "...                                ...                       ...   \n",
       "2017-11-16 21:00:00+00:00          ...             -5.373486e+09   \n",
       "2017-11-17 21:00:00+00:00          ...             -5.460552e+09   \n",
       "2017-11-20 21:00:00+00:00          ...             -5.526415e+09   \n",
       "2017-11-21 21:00:00+00:00          ...             -5.609237e+09   \n",
       "2017-11-22 21:00:00+00:00          ...             -5.635541e+09   \n",
       "2017-11-24 18:00:00+00:00          ...             -5.691530e+09   \n",
       "2017-11-27 21:00:00+00:00          ...             -5.711983e+09   \n",
       "2017-11-28 21:00:00+00:00          ...             -5.995670e+09   \n",
       "2017-11-29 21:00:00+00:00          ...             -6.295564e+09   \n",
       "2017-11-30 21:00:00+00:00          ...             -6.613459e+09   \n",
       "2017-12-01 21:00:00+00:00          ...             -6.786832e+09   \n",
       "2017-12-04 21:00:00+00:00          ...             -6.801193e+09   \n",
       "2017-12-05 21:00:00+00:00          ...             -6.836817e+09   \n",
       "2017-12-06 21:00:00+00:00          ...             -6.868267e+09   \n",
       "2017-12-07 21:00:00+00:00          ...             -6.956507e+09   \n",
       "2017-12-08 21:00:00+00:00          ...             -6.971974e+09   \n",
       "2017-12-11 21:00:00+00:00          ...             -7.056728e+09   \n",
       "2017-12-12 21:00:00+00:00          ...             -7.111451e+09   \n",
       "2017-12-13 21:00:00+00:00          ...             -7.229208e+09   \n",
       "2017-12-14 21:00:00+00:00          ...             -7.275907e+09   \n",
       "2017-12-15 21:00:00+00:00          ...             -7.518819e+09   \n",
       "2017-12-18 21:00:00+00:00          ...             -7.728746e+09   \n",
       "2017-12-19 21:00:00+00:00          ...             -7.786011e+09   \n",
       "2017-12-20 21:00:00+00:00          ...             -7.873819e+09   \n",
       "2017-12-21 21:00:00+00:00          ...             -7.980043e+09   \n",
       "2017-12-22 21:00:00+00:00          ...             -8.103919e+09   \n",
       "2017-12-26 21:00:00+00:00          ...             -8.134393e+09   \n",
       "2017-12-27 21:00:00+00:00          ...             -8.206119e+09   \n",
       "2017-12-28 21:00:00+00:00          ...             -8.280849e+09   \n",
       "2017-12-29 21:00:00+00:00          ...             -8.294057e+09   \n",
       "\n",
       "                            short_value  shorts_count    sortino  \\\n",
       "2015-01-02 21:00:00+00:00  0.000000e+00             0        NaN   \n",
       "2015-01-05 21:00:00+00:00 -4.559213e+06             4 -11.224972   \n",
       "2015-01-06 21:00:00+00:00 -1.853431e+07             5  -9.457366   \n",
       "2015-01-07 21:00:00+00:00 -2.447996e+07             5 -10.264901   \n",
       "2015-01-08 21:00:00+00:00 -2.968687e+07             5 -10.014855   \n",
       "2015-01-09 21:00:00+00:00 -3.440583e+07             5  -9.932744   \n",
       "2015-01-12 21:00:00+00:00 -3.549011e+07             5  -4.118403   \n",
       "2015-01-13 21:00:00+00:00 -4.012069e+07             8  -2.478067   \n",
       "2015-01-14 21:00:00+00:00 -4.166767e+07             8  -5.316664   \n",
       "2015-01-15 21:00:00+00:00 -3.977263e+07             7   0.156254   \n",
       "2015-01-16 21:00:00+00:00 -4.240260e+07             7  -3.331612   \n",
       "2015-01-20 21:00:00+00:00 -4.588095e+07             6  -3.544205   \n",
       "2015-01-21 21:00:00+00:00 -6.097007e+07            15  -5.513570   \n",
       "2015-01-22 21:00:00+00:00 -6.848702e+07            15  -4.960051   \n",
       "2015-01-23 21:00:00+00:00 -7.501632e+07            14  -3.237792   \n",
       "2015-01-26 21:00:00+00:00 -8.293347e+07            14  -4.904806   \n",
       "2015-01-27 21:00:00+00:00 -8.687812e+07            16  -5.108828   \n",
       "2015-01-28 21:00:00+00:00 -7.909577e+07            15  -3.074204   \n",
       "2015-01-29 21:00:00+00:00 -7.711712e+07            15  -3.046823   \n",
       "2015-01-30 21:00:00+00:00 -7.878094e+07            13  -2.133005   \n",
       "2015-02-02 21:00:00+00:00 -8.105022e+07            12  -1.822251   \n",
       "2015-02-03 21:00:00+00:00 -1.009457e+08            17  -3.230177   \n",
       "2015-02-04 21:00:00+00:00 -1.059558e+08            16  -1.819097   \n",
       "2015-02-05 21:00:00+00:00 -1.090863e+08            16  -3.091268   \n",
       "2015-02-06 21:00:00+00:00 -1.085976e+08            16  -0.943388   \n",
       "2015-02-09 21:00:00+00:00 -1.089109e+08            16  -0.001778   \n",
       "2015-02-10 21:00:00+00:00 -1.335594e+08            23  -1.023983   \n",
       "2015-02-11 21:00:00+00:00 -1.301772e+08            22   1.125198   \n",
       "2015-02-12 21:00:00+00:00 -1.384165e+08            21  -0.336516   \n",
       "2015-02-13 21:00:00+00:00 -1.387468e+08            20  -0.056628   \n",
       "...                                 ...           ...        ...   \n",
       "2017-11-16 21:00:00+00:00 -5.373486e+09            63  -0.351605   \n",
       "2017-11-17 21:00:00+00:00 -5.460552e+09            63  -0.347155   \n",
       "2017-11-20 21:00:00+00:00 -5.526415e+09            61  -0.344576   \n",
       "2017-11-21 21:00:00+00:00 -5.609237e+09            66  -0.343322   \n",
       "2017-11-22 21:00:00+00:00 -5.635541e+09            66  -0.343698   \n",
       "2017-11-24 18:00:00+00:00 -5.691530e+09            66  -0.344260   \n",
       "2017-11-27 21:00:00+00:00 -5.711983e+09            65  -0.342912   \n",
       "2017-11-28 21:00:00+00:00 -5.995670e+09            69  -0.340190   \n",
       "2017-11-29 21:00:00+00:00 -6.295564e+09            69  -0.339895   \n",
       "2017-11-30 21:00:00+00:00 -6.613459e+09            69  -0.338219   \n",
       "2017-12-01 21:00:00+00:00 -6.786832e+09            69  -0.337271   \n",
       "2017-12-04 21:00:00+00:00 -6.801193e+09            69  -0.338327   \n",
       "2017-12-05 21:00:00+00:00 -6.836817e+09            79  -0.339890   \n",
       "2017-12-06 21:00:00+00:00 -6.868267e+09            79  -0.341154   \n",
       "2017-12-07 21:00:00+00:00 -6.956507e+09            78  -0.338466   \n",
       "2017-12-08 21:00:00+00:00 -6.971974e+09            77  -0.335666   \n",
       "2017-12-11 21:00:00+00:00 -7.056728e+09            77  -0.335724   \n",
       "2017-12-12 21:00:00+00:00 -7.111451e+09            81  -0.335528   \n",
       "2017-12-13 21:00:00+00:00 -7.229208e+09            81  -0.334862   \n",
       "2017-12-14 21:00:00+00:00 -7.275907e+09            80  -0.337064   \n",
       "2017-12-15 21:00:00+00:00 -7.518819e+09            80  -0.334674   \n",
       "2017-12-18 21:00:00+00:00 -7.728746e+09            80  -0.332185   \n",
       "2017-12-19 21:00:00+00:00 -7.786011e+09            85  -0.332921   \n",
       "2017-12-20 21:00:00+00:00 -7.873819e+09            84  -0.332286   \n",
       "2017-12-21 21:00:00+00:00 -7.980043e+09            83  -0.330457   \n",
       "2017-12-22 21:00:00+00:00 -8.103919e+09            83  -0.330618   \n",
       "2017-12-26 21:00:00+00:00 -8.134393e+09            83  -0.329407   \n",
       "2017-12-27 21:00:00+00:00 -8.206119e+09            91  -0.329145   \n",
       "2017-12-28 21:00:00+00:00 -8.280849e+09            91  -0.329258   \n",
       "2017-12-29 21:00:00+00:00 -8.294057e+09            91  -0.329649   \n",
       "\n",
       "                           starting_cash  starting_exposure  starting_value  \\\n",
       "2015-01-02 21:00:00+00:00   1.000000e+07       0.000000e+00    0.000000e+00   \n",
       "2015-01-05 21:00:00+00:00   1.000000e+07       0.000000e+00    0.000000e+00   \n",
       "2015-01-06 21:00:00+00:00   1.455774e+07      -4.559213e+06   -4.559213e+06   \n",
       "2015-01-07 21:00:00+00:00   2.848728e+07      -1.853431e+07   -1.853431e+07   \n",
       "2015-01-08 21:00:00+00:00   3.430868e+07      -2.447996e+07   -2.447996e+07   \n",
       "2015-01-09 21:00:00+00:00   3.919119e+07      -2.968687e+07   -2.968687e+07   \n",
       "2015-01-12 21:00:00+00:00   4.324892e+07      -3.440583e+07   -3.440583e+07   \n",
       "2015-01-13 21:00:00+00:00   4.491797e+07      -3.549011e+07   -3.549011e+07   \n",
       "2015-01-14 21:00:00+00:00   4.972895e+07      -4.012069e+07   -4.012069e+07   \n",
       "2015-01-15 21:00:00+00:00   5.057631e+07      -4.166767e+07   -4.166767e+07   \n",
       "2015-01-16 21:00:00+00:00   4.966693e+07      -3.977263e+07   -3.977263e+07   \n",
       "2015-01-20 21:00:00+00:00   5.120758e+07      -4.240260e+07   -4.240260e+07   \n",
       "2015-01-21 21:00:00+00:00   5.457815e+07      -4.588095e+07   -4.588095e+07   \n",
       "2015-01-22 21:00:00+00:00   6.835600e+07      -6.097007e+07   -6.097007e+07   \n",
       "2015-01-23 21:00:00+00:00   7.600532e+07      -6.848702e+07   -6.848702e+07   \n",
       "2015-01-26 21:00:00+00:00   8.314873e+07      -7.501632e+07   -7.501632e+07   \n",
       "2015-01-27 21:00:00+00:00   8.971768e+07      -8.293347e+07   -8.293347e+07   \n",
       "2015-01-28 21:00:00+00:00   9.348290e+07      -8.687812e+07   -8.687812e+07   \n",
       "2015-01-29 21:00:00+00:00   8.661206e+07      -7.909577e+07   -7.909577e+07   \n",
       "2015-01-30 21:00:00+00:00   8.460244e+07      -7.711712e+07   -7.711712e+07   \n",
       "2015-02-02 21:00:00+00:00   8.674818e+07      -7.878094e+07   -7.878094e+07   \n",
       "2015-02-03 21:00:00+00:00   8.918039e+07      -8.105022e+07   -8.105022e+07   \n",
       "2015-02-04 21:00:00+00:00   1.077994e+08      -1.009457e+08   -1.009457e+08   \n",
       "2015-02-05 21:00:00+00:00   1.136837e+08      -1.059558e+08   -1.059558e+08   \n",
       "2015-02-06 21:00:00+00:00   1.155232e+08      -1.090863e+08   -1.090863e+08   \n",
       "2015-02-09 21:00:00+00:00   1.165422e+08      -1.085976e+08   -1.085976e+08   \n",
       "2015-02-10 21:00:00+00:00   1.176958e+08      -1.089109e+08   -1.089109e+08   \n",
       "2015-02-11 21:00:00+00:00   1.412317e+08      -1.335594e+08   -1.335594e+08   \n",
       "2015-02-12 21:00:00+00:00   1.399118e+08      -1.301772e+08   -1.301772e+08   \n",
       "2015-02-13 21:00:00+00:00   1.462986e+08      -1.384165e+08   -1.384165e+08   \n",
       "...                                  ...                ...             ...   \n",
       "2017-11-16 21:00:00+00:00  -1.537534e+10       1.554679e+10    1.554679e+10   \n",
       "2017-11-17 21:00:00+00:00  -1.523342e+10       1.563931e+10    1.563931e+10   \n",
       "2017-11-20 21:00:00+00:00  -1.517723e+10       1.571008e+10    1.571008e+10   \n",
       "2017-11-21 21:00:00+00:00  -1.484163e+10       1.546728e+10    1.546728e+10   \n",
       "2017-11-22 21:00:00+00:00  -1.480042e+10       1.547346e+10    1.547346e+10   \n",
       "2017-11-24 18:00:00+00:00  -1.477922e+10       1.542157e+10    1.542157e+10   \n",
       "2017-11-27 21:00:00+00:00  -1.476031e+10       1.536451e+10    1.536451e+10   \n",
       "2017-11-28 21:00:00+00:00  -1.471536e+10       1.536968e+10    1.536968e+10   \n",
       "2017-11-29 21:00:00+00:00  -1.450843e+10       1.528430e+10    1.528430e+10   \n",
       "2017-11-30 21:00:00+00:00  -1.412256e+10       1.490209e+10    1.490209e+10   \n",
       "2017-12-01 21:00:00+00:00  -1.390556e+10       1.476923e+10    1.476923e+10   \n",
       "2017-12-04 21:00:00+00:00  -1.370803e+10       1.461814e+10    1.461814e+10   \n",
       "2017-12-05 21:00:00+00:00  -1.364153e+10       1.446405e+10    1.446405e+10   \n",
       "2017-12-06 21:00:00+00:00  -1.362486e+10       1.433684e+10    1.433684e+10   \n",
       "2017-12-07 21:00:00+00:00  -1.362825e+10       1.426047e+10    1.426047e+10   \n",
       "2017-12-08 21:00:00+00:00  -1.364009e+10       1.438882e+10    1.438882e+10   \n",
       "2017-12-11 21:00:00+00:00  -1.364761e+10       1.454086e+10    1.454086e+10   \n",
       "2017-12-12 21:00:00+00:00  -1.360717e+10       1.448132e+10    1.448132e+10   \n",
       "2017-12-13 21:00:00+00:00  -1.352861e+10       1.440076e+10    1.440076e+10   \n",
       "2017-12-14 21:00:00+00:00  -1.346323e+10       1.436431e+10    1.436431e+10   \n",
       "2017-12-15 21:00:00+00:00  -1.336602e+10       1.410230e+10    1.410230e+10   \n",
       "2017-12-18 21:00:00+00:00  -1.320975e+10       1.406600e+10    1.406600e+10   \n",
       "2017-12-19 21:00:00+00:00  -1.310779e+10       1.411019e+10    1.411019e+10   \n",
       "2017-12-20 21:00:00+00:00  -1.302664e+10       1.395660e+10    1.395660e+10   \n",
       "2017-12-21 21:00:00+00:00  -1.293801e+10       1.389697e+10    1.389697e+10   \n",
       "2017-12-22 21:00:00+00:00  -1.280938e+10       1.388469e+10    1.388469e+10   \n",
       "2017-12-26 21:00:00+00:00  -1.269242e+10       1.373676e+10    1.373676e+10   \n",
       "2017-12-27 21:00:00+00:00  -1.263247e+10       1.375507e+10    1.375507e+10   \n",
       "2017-12-28 21:00:00+00:00  -1.255643e+10       1.368271e+10    1.368271e+10   \n",
       "2017-12-29 21:00:00+00:00  -1.246350e+10       1.356149e+10    1.356149e+10   \n",
       "\n",
       "                           trading_days  \\\n",
       "2015-01-02 21:00:00+00:00             1   \n",
       "2015-01-05 21:00:00+00:00             2   \n",
       "2015-01-06 21:00:00+00:00             3   \n",
       "2015-01-07 21:00:00+00:00             4   \n",
       "2015-01-08 21:00:00+00:00             5   \n",
       "2015-01-09 21:00:00+00:00             6   \n",
       "2015-01-12 21:00:00+00:00             7   \n",
       "2015-01-13 21:00:00+00:00             8   \n",
       "2015-01-14 21:00:00+00:00             9   \n",
       "2015-01-15 21:00:00+00:00            10   \n",
       "2015-01-16 21:00:00+00:00            11   \n",
       "2015-01-20 21:00:00+00:00            12   \n",
       "2015-01-21 21:00:00+00:00            13   \n",
       "2015-01-22 21:00:00+00:00            14   \n",
       "2015-01-23 21:00:00+00:00            15   \n",
       "2015-01-26 21:00:00+00:00            16   \n",
       "2015-01-27 21:00:00+00:00            17   \n",
       "2015-01-28 21:00:00+00:00            18   \n",
       "2015-01-29 21:00:00+00:00            19   \n",
       "2015-01-30 21:00:00+00:00            20   \n",
       "2015-02-02 21:00:00+00:00            21   \n",
       "2015-02-03 21:00:00+00:00            22   \n",
       "2015-02-04 21:00:00+00:00            23   \n",
       "2015-02-05 21:00:00+00:00            24   \n",
       "2015-02-06 21:00:00+00:00            25   \n",
       "2015-02-09 21:00:00+00:00            26   \n",
       "2015-02-10 21:00:00+00:00            27   \n",
       "2015-02-11 21:00:00+00:00            28   \n",
       "2015-02-12 21:00:00+00:00            29   \n",
       "2015-02-13 21:00:00+00:00            30   \n",
       "...                                 ...   \n",
       "2017-11-16 21:00:00+00:00           726   \n",
       "2017-11-17 21:00:00+00:00           727   \n",
       "2017-11-20 21:00:00+00:00           728   \n",
       "2017-11-21 21:00:00+00:00           729   \n",
       "2017-11-22 21:00:00+00:00           730   \n",
       "2017-11-24 18:00:00+00:00           731   \n",
       "2017-11-27 21:00:00+00:00           732   \n",
       "2017-11-28 21:00:00+00:00           733   \n",
       "2017-11-29 21:00:00+00:00           734   \n",
       "2017-11-30 21:00:00+00:00           735   \n",
       "2017-12-01 21:00:00+00:00           736   \n",
       "2017-12-04 21:00:00+00:00           737   \n",
       "2017-12-05 21:00:00+00:00           738   \n",
       "2017-12-06 21:00:00+00:00           739   \n",
       "2017-12-07 21:00:00+00:00           740   \n",
       "2017-12-08 21:00:00+00:00           741   \n",
       "2017-12-11 21:00:00+00:00           742   \n",
       "2017-12-12 21:00:00+00:00           743   \n",
       "2017-12-13 21:00:00+00:00           744   \n",
       "2017-12-14 21:00:00+00:00           745   \n",
       "2017-12-15 21:00:00+00:00           746   \n",
       "2017-12-18 21:00:00+00:00           747   \n",
       "2017-12-19 21:00:00+00:00           748   \n",
       "2017-12-20 21:00:00+00:00           749   \n",
       "2017-12-21 21:00:00+00:00           750   \n",
       "2017-12-22 21:00:00+00:00           751   \n",
       "2017-12-26 21:00:00+00:00           752   \n",
       "2017-12-27 21:00:00+00:00           753   \n",
       "2017-12-28 21:00:00+00:00           754   \n",
       "2017-12-29 21:00:00+00:00           755   \n",
       "\n",
       "                                                                transactions  \\\n",
       "2015-01-02 21:00:00+00:00                                                 []   \n",
       "2015-01-05 21:00:00+00:00  [{u'commission': None, u'amount': -25524, u'si...   \n",
       "2015-01-06 21:00:00+00:00  [{u'commission': None, u'amount': -30574, u'si...   \n",
       "2015-01-07 21:00:00+00:00  [{u'commission': None, u'amount': -22032, u'si...   \n",
       "2015-01-08 21:00:00+00:00  [{u'commission': None, u'amount': -50424, u'si...   \n",
       "2015-01-09 21:00:00+00:00  [{u'commission': None, u'amount': -29366, u'si...   \n",
       "2015-01-12 21:00:00+00:00  [{u'commission': None, u'amount': -19344, u'si...   \n",
       "2015-01-13 21:00:00+00:00  [{u'commission': None, u'amount': -17806, u'si...   \n",
       "2015-01-14 21:00:00+00:00  [{u'commission': None, u'amount': -47673, u'si...   \n",
       "2015-01-15 21:00:00+00:00  [{u'commission': None, u'amount': -9372, u'sid...   \n",
       "2015-01-16 21:00:00+00:00  [{u'commission': None, u'amount': -17798, u'si...   \n",
       "2015-01-20 21:00:00+00:00  [{u'commission': None, u'amount': -115267, u's...   \n",
       "2015-01-21 21:00:00+00:00  [{u'commission': None, u'amount': -99824, u'si...   \n",
       "2015-01-22 21:00:00+00:00  [{u'commission': None, u'amount': -74300, u'si...   \n",
       "2015-01-23 21:00:00+00:00  [{u'commission': None, u'amount': -108498, u's...   \n",
       "2015-01-26 21:00:00+00:00  [{u'commission': None, u'amount': -127595, u's...   \n",
       "2015-01-27 21:00:00+00:00  [{u'commission': None, u'amount': -124112, u's...   \n",
       "2015-01-28 21:00:00+00:00  [{u'commission': None, u'amount': -76343, u'si...   \n",
       "2015-01-29 21:00:00+00:00  [{u'commission': None, u'amount': -136315, u's...   \n",
       "2015-01-30 21:00:00+00:00  [{u'commission': None, u'amount': -103178, u's...   \n",
       "2015-02-02 21:00:00+00:00  [{u'commission': None, u'amount': -12267, u'si...   \n",
       "2015-02-03 21:00:00+00:00  [{u'commission': None, u'amount': 69168, u'sid...   \n",
       "2015-02-04 21:00:00+00:00  [{u'commission': None, u'amount': -11069, u'si...   \n",
       "2015-02-05 21:00:00+00:00  [{u'commission': None, u'amount': 61140, u'sid...   \n",
       "2015-02-06 21:00:00+00:00  [{u'commission': None, u'amount': 75944, u'sid...   \n",
       "2015-02-09 21:00:00+00:00  [{u'commission': None, u'amount': 56031, u'sid...   \n",
       "2015-02-10 21:00:00+00:00  [{u'commission': None, u'amount': 118050, u'si...   \n",
       "2015-02-11 21:00:00+00:00  [{u'commission': None, u'amount': 79162, u'sid...   \n",
       "2015-02-12 21:00:00+00:00  [{u'commission': None, u'amount': 89169, u'sid...   \n",
       "2015-02-13 21:00:00+00:00  [{u'commission': None, u'amount': 80374, u'sid...   \n",
       "...                                                                      ...   \n",
       "2017-11-16 21:00:00+00:00  [{u'commission': None, u'amount': -78487, u'si...   \n",
       "2017-11-17 21:00:00+00:00  [{u'commission': None, u'amount': -57948, u'si...   \n",
       "2017-11-20 21:00:00+00:00  [{u'commission': None, u'amount': -75139, u'si...   \n",
       "2017-11-21 21:00:00+00:00  [{u'commission': None, u'amount': -77692, u'si...   \n",
       "2017-11-22 21:00:00+00:00  [{u'commission': None, u'amount': -70514, u'si...   \n",
       "2017-11-24 18:00:00+00:00  [{u'commission': None, u'amount': -42427, u'si...   \n",
       "2017-11-27 21:00:00+00:00  [{u'commission': None, u'amount': -92039, u'si...   \n",
       "2017-11-28 21:00:00+00:00  [{u'commission': None, u'amount': -85669, u'si...   \n",
       "2017-11-29 21:00:00+00:00  [{u'commission': None, u'amount': -90061, u'si...   \n",
       "2017-11-30 21:00:00+00:00  [{u'commission': None, u'amount': -164633, u's...   \n",
       "2017-12-01 21:00:00+00:00  [{u'commission': None, u'amount': -116333, u's...   \n",
       "2017-12-04 21:00:00+00:00  [{u'commission': None, u'amount': -107525, u's...   \n",
       "2017-12-05 21:00:00+00:00  [{u'commission': None, u'amount': -67819, u'si...   \n",
       "2017-12-06 21:00:00+00:00  [{u'commission': None, u'amount': -75867, u'si...   \n",
       "2017-12-07 21:00:00+00:00  [{u'commission': None, u'amount': -76060, u'si...   \n",
       "2017-12-08 21:00:00+00:00  [{u'commission': None, u'amount': -48480, u'si...   \n",
       "2017-12-11 21:00:00+00:00  [{u'commission': None, u'amount': -138572, u's...   \n",
       "2017-12-12 21:00:00+00:00  [{u'commission': None, u'amount': -160235, u's...   \n",
       "2017-12-13 21:00:00+00:00  [{u'commission': None, u'amount': -153955, u's...   \n",
       "2017-12-14 21:00:00+00:00  [{u'commission': None, u'amount': -134565, u's...   \n",
       "2017-12-15 21:00:00+00:00  [{u'commission': None, u'amount': -198249, u's...   \n",
       "2017-12-18 21:00:00+00:00  [{u'commission': None, u'amount': -217061, u's...   \n",
       "2017-12-19 21:00:00+00:00  [{u'commission': None, u'amount': -266117, u's...   \n",
       "2017-12-20 21:00:00+00:00  [{u'commission': None, u'amount': -136681, u's...   \n",
       "2017-12-21 21:00:00+00:00  [{u'commission': None, u'amount': -133495, u's...   \n",
       "2017-12-22 21:00:00+00:00  [{u'commission': None, u'amount': -156981, u's...   \n",
       "2017-12-26 21:00:00+00:00  [{u'commission': None, u'amount': -85662, u'si...   \n",
       "2017-12-27 21:00:00+00:00  [{u'commission': None, u'amount': -52970, u'si...   \n",
       "2017-12-28 21:00:00+00:00  [{u'commission': None, u'amount': -46213, u'si...   \n",
       "2017-12-29 21:00:00+00:00  [{u'commission': None, u'amount': -47405, u'si...   \n",
       "\n",
       "                          treasury_period_return  \n",
       "2015-01-02 21:00:00+00:00                    0.0  \n",
       "2015-01-05 21:00:00+00:00                    0.0  \n",
       "2015-01-06 21:00:00+00:00                    0.0  \n",
       "2015-01-07 21:00:00+00:00                    0.0  \n",
       "2015-01-08 21:00:00+00:00                    0.0  \n",
       "2015-01-09 21:00:00+00:00                    0.0  \n",
       "2015-01-12 21:00:00+00:00                    0.0  \n",
       "2015-01-13 21:00:00+00:00                    0.0  \n",
       "2015-01-14 21:00:00+00:00                    0.0  \n",
       "2015-01-15 21:00:00+00:00                    0.0  \n",
       "2015-01-16 21:00:00+00:00                    0.0  \n",
       "2015-01-20 21:00:00+00:00                    0.0  \n",
       "2015-01-21 21:00:00+00:00                    0.0  \n",
       "2015-01-22 21:00:00+00:00                    0.0  \n",
       "2015-01-23 21:00:00+00:00                    0.0  \n",
       "2015-01-26 21:00:00+00:00                    0.0  \n",
       "2015-01-27 21:00:00+00:00                    0.0  \n",
       "2015-01-28 21:00:00+00:00                    0.0  \n",
       "2015-01-29 21:00:00+00:00                    0.0  \n",
       "2015-01-30 21:00:00+00:00                    0.0  \n",
       "2015-02-02 21:00:00+00:00                    0.0  \n",
       "2015-02-03 21:00:00+00:00                    0.0  \n",
       "2015-02-04 21:00:00+00:00                    0.0  \n",
       "2015-02-05 21:00:00+00:00                    0.0  \n",
       "2015-02-06 21:00:00+00:00                    0.0  \n",
       "2015-02-09 21:00:00+00:00                    0.0  \n",
       "2015-02-10 21:00:00+00:00                    0.0  \n",
       "2015-02-11 21:00:00+00:00                    0.0  \n",
       "2015-02-12 21:00:00+00:00                    0.0  \n",
       "2015-02-13 21:00:00+00:00                    0.0  \n",
       "...                                          ...  \n",
       "2017-11-16 21:00:00+00:00                    0.0  \n",
       "2017-11-17 21:00:00+00:00                    0.0  \n",
       "2017-11-20 21:00:00+00:00                    0.0  \n",
       "2017-11-21 21:00:00+00:00                    0.0  \n",
       "2017-11-22 21:00:00+00:00                    0.0  \n",
       "2017-11-24 18:00:00+00:00                    0.0  \n",
       "2017-11-27 21:00:00+00:00                    0.0  \n",
       "2017-11-28 21:00:00+00:00                    0.0  \n",
       "2017-11-29 21:00:00+00:00                    0.0  \n",
       "2017-11-30 21:00:00+00:00                    0.0  \n",
       "2017-12-01 21:00:00+00:00                    0.0  \n",
       "2017-12-04 21:00:00+00:00                    0.0  \n",
       "2017-12-05 21:00:00+00:00                    0.0  \n",
       "2017-12-06 21:00:00+00:00                    0.0  \n",
       "2017-12-07 21:00:00+00:00                    0.0  \n",
       "2017-12-08 21:00:00+00:00                    0.0  \n",
       "2017-12-11 21:00:00+00:00                    0.0  \n",
       "2017-12-12 21:00:00+00:00                    0.0  \n",
       "2017-12-13 21:00:00+00:00                    0.0  \n",
       "2017-12-14 21:00:00+00:00                    0.0  \n",
       "2017-12-15 21:00:00+00:00                    0.0  \n",
       "2017-12-18 21:00:00+00:00                    0.0  \n",
       "2017-12-19 21:00:00+00:00                    0.0  \n",
       "2017-12-20 21:00:00+00:00                    0.0  \n",
       "2017-12-21 21:00:00+00:00                    0.0  \n",
       "2017-12-22 21:00:00+00:00                    0.0  \n",
       "2017-12-26 21:00:00+00:00                    0.0  \n",
       "2017-12-27 21:00:00+00:00                    0.0  \n",
       "2017-12-28 21:00:00+00:00                    0.0  \n",
       "2017-12-29 21:00:00+00:00                    0.0  \n",
       "\n",
       "[755 rows x 39 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%zipline --start 2015-1-1 --end 2018-1-1 --output single_factor.pickle\n",
    "\n",
    "from zipline.api import (\n",
    "    attach_pipeline,\n",
    "    date_rules,\n",
    "    time_rules,\n",
    "    order_target_percent,\n",
    "    pipeline_output,\n",
    "    record,\n",
    "    schedule_function,\n",
    "    get_open_orders,\n",
    "    calendars\n",
    ")\n",
    "from zipline.finance import commission, slippage\n",
    "from zipline.pipeline import Pipeline, CustomFactor\n",
    "from zipline.pipeline.factors import Returns, AverageDollarVolume\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "MONTH = 21\n",
    "YEAR = 12 * MONTH\n",
    "N_LONGS = N_SHORTS = 25\n",
    "VOL_SCREEN = 1000\n",
    "\n",
    "\n",
    "class MeanReversion(CustomFactor):\n",
    "    \"\"\"Compute ratio of latest monthly return to 12m average,\n",
    "       normalized by std dev of monthly returns\"\"\"\n",
    "    inputs = [Returns(window_length=MONTH)]\n",
    "    window_length = YEAR\n",
    "\n",
    "    def compute(self, today, assets, out, monthly_returns):\n",
    "        df = pd.DataFrame(monthly_returns)\n",
    "        out[:] = df.iloc[-1].sub(df.mean()).div(df.std())\n",
    "\n",
    "\n",
    "def compute_factors():\n",
    "    \"\"\"Create factor pipeline incl. mean reversion,\n",
    "        filtered by 30d Dollar Volume; capture factor ranks\"\"\"\n",
    "    mean_reversion = MeanReversion()\n",
    "    dollar_volume = AverageDollarVolume(window_length=30)\n",
    "    return Pipeline(columns={'longs': mean_reversion.bottom(N_LONGS),\n",
    "                             'shorts': mean_reversion.top(N_SHORTS),\n",
    "                             'ranking': mean_reversion.rank(ascending=False)},\n",
    "                    screen=dollar_volume.top(VOL_SCREEN))\n",
    "\n",
    "\n",
    "def exec_trades(data, assets, target_percent):\n",
    "    \"\"\"Place orders for assets using target portfolio percentage\"\"\"\n",
    "    for asset in assets:\n",
    "        if data.can_trade(asset) and not get_open_orders(asset):\n",
    "            order_target_percent(asset, target_percent)\n",
    "\n",
    "\n",
    "def rebalance(context, data):\n",
    "    \"\"\"Compute long, short and obsolete holdings; place trade orders\"\"\"\n",
    "    factor_data = context.factor_data\n",
    "    record(factor_data=factor_data.ranking)\n",
    "\n",
    "    assets = factor_data.index\n",
    "    record(prices=data.current(assets, 'price'))\n",
    "\n",
    "    longs = assets[factor_data.longs]\n",
    "    shorts = assets[factor_data.shorts]\n",
    "    divest = set(context.portfolio.positions.keys()) - set(longs.union(shorts))\n",
    "\n",
    "    exec_trades(data, assets=divest, target_percent=0)\n",
    "    exec_trades(data, assets=longs, target_percent=1 / N_LONGS)\n",
    "    exec_trades(data, assets=shorts, target_percent=-1 / N_SHORTS)\n",
    "\n",
    "\n",
    "def initialize(context):\n",
    "    \"\"\"Setup: register pipeline, schedule rebalancing,\n",
    "        and set trading params\"\"\"\n",
    "    attach_pipeline(compute_factors(), 'factor_pipeline')\n",
    "    schedule_function(rebalance,\n",
    "                      date_rules.week_start(),\n",
    "                      time_rules.market_open(),\n",
    "                      calendar=calendars.US_EQUITIES)\n",
    "    context.set_commission(commission.PerShare(cost=.01, min_trade_cost=0))\n",
    "    context.set_slippage(slippage.VolumeShareSlippage())\n",
    "\n",
    "\n",
    "def before_trading_start(context, data):\n",
    "    \"\"\"Run factor pipeline\"\"\"\n",
    "    context.factor_data = pipeline_output('factor_pipeline')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": true,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "512px"
   },
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
